您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetAreaEntryByAreaID函数代码示例

51自学网 2021-06-01 21:03:49
  C++
这篇教程C++ GetAreaEntryByAreaID函数代码示例写得很实用,希望能帮到您。

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

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

示例1: DEBUG_LOG

//.........这里部分代码省略.........        }        // do not process players which are not in world        if (!pl->IsInWorld())            continue;        // check if target is globally visible for player        if (!pl->IsVisibleGloballyFor(_player))            continue;        // check if target's level is in level range        uint32 lvl = pl->getLevel();        if (lvl < level_min || lvl > level_max)            continue;        // check if class matches classmask        uint32 class_ = pl->getClass();        if (!(classmask & (1 << class_)))            continue;        // check if race matches racemask        uint32 race = pl->getRace();        if (!(racemask & (1 << race)))            continue;        uint32 pzoneid = pl->GetZoneId();        bool z_show = true;        for (uint32 i = 0; i < zones_count; ++i)        {            if (zoneids[i] == pzoneid)            {                z_show = true;                break;            }            z_show = false;        }        if (!z_show)            continue;        std::string pname = pl->GetName();        std::wstring wpname;        if (!Utf8toWStr(pname, wpname))            continue;        wstrToLower(wpname);        if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))            continue;        std::string gname = sGuildMgr.GetGuildNameById(pl->GetGuildId());        std::wstring wgname;        if (!Utf8toWStr(gname, wgname))            continue;        wstrToLower(wgname);        if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))            continue;        std::string aname;        if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(pzoneid))            aname = areaEntry->area_name[GetSessionDbcLocale()];        bool s_show = true;        for (uint32 i = 0; i < str_count; ++i)        {            if (!str[i].empty())            {                if (wgname.find(str[i]) != std::wstring::npos ||                        wpname.find(str[i]) != std::wstring::npos ||                        Utf8FitTo(aname, str[i]))                {                    s_show = true;                    break;                }                s_show = false;            }        }        if (!s_show)            continue;        data << pname;                                      // player name        data << gname;                                      // guild name        data << uint32(lvl);                                // player level        data << uint32(class_);                             // player class        data << uint32(race);                               // player race        data << uint32(pzoneid);                            // player zone id        // 50 is maximum player count sent to client        if ((++clientcount) == 49)            break;    }    uint32 count = m.size();    data.put(0, clientcount);                               // insert right count, listed count    data.put(4, count > 49 ? count : clientcount);          // insert right count, online count    SendPacket(&data);    DEBUG_LOG("WORLD: Send SMSG_WHO Message");}
开发者ID:monstermosh,项目名称:ZeroServer,代码行数:101,


示例2: event

bool SmartAIMgr::IsEventValid(SmartScriptHolder &e){    if (e.event.type >= SMART_EVENT_END)    {        sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());        return false;    }    // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core    if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1]))    {        sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());        return false;    }    if (e.action.type >= SMART_ACTION_END)    {        sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());        return false;    }    if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)    {        sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);        return false;    }    if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)    {        e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script!        if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false;        if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false;    }    else    {        uint32 type = e.event.type;        switch (type)        {            case SMART_EVENT_UPDATE:            case SMART_EVENT_UPDATE_IC:            case SMART_EVENT_UPDATE_OOC:            case SMART_EVENT_HEALT_PCT:            case SMART_EVENT_MANA_PCT:            case SMART_EVENT_TARGET_HEALTH_PCT:            case SMART_EVENT_TARGET_MANA_PCT:            case SMART_EVENT_RANGE:            case SMART_EVENT_DAMAGED:            case SMART_EVENT_DAMAGED_TARGET:            case SMART_EVENT_RECEIVE_HEAL:                if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false;                if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false;                break;            case SMART_EVENT_SPELLHIT:            case SMART_EVENT_SPELLHIT_TARGET:                if (e.event.spellHit.spell)                {                    SpellEntry const* pSpell = sSpellStore.LookupEntry(e.event.spellHit.spell);                    if (!pSpell)                    {                        sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);                        return false;                    }                    if (e.event.spellHit.school && (e.event.spellHit.school & pSpell->SchoolMask) != pSpell->SchoolMask)                    {                        sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);                        return false;                    }                }                if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax)) return false;                break;            case SMART_EVENT_OOC_LOS:            case SMART_EVENT_IC_LOS:                if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax)) return false;                break;            case SMART_EVENT_RESPAWN:                if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))                {                    sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);                    return false;                }                if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area))                {                    sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);                    return false;                }                break;            case SMART_EVENT_FRIENDLY_HEALTH:                if (!NotNULL(e, e.event.friendlyHealt.radius)) return false;                if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax)) return false;                break;            case SMART_EVENT_FRIENDLY_IS_CC:                if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax)) return false;                break;            case SMART_EVENT_FRIENDLY_MISSING_BUFF:            {                if (!IsSpellValid(e, e.event.missingBuff.spell)) return false;                if (!NotNULL(e, e.event.missingBuff.radius)) return false;                if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax)) return false;                break;            }            case SMART_EVENT_KILL:                if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax)) return false;                if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) return false;                break;//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:Singularity,代码行数:101,


示例3: HandleGroupListCommand

    static bool HandleGroupListCommand(ChatHandler* handler, char const* args)    {        // Get ALL the variables!        Player* playerTarget;        uint32 phase = 0;        uint64 guidTarget;        std::string nameTarget;        std::string zoneName;        const char* onlineState = "";        // Parse the guid to uint32...        uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);        // ... and try to extract a player out of it.        if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))        {            playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID);            guidTarget = parseGUID;        }        // If not, we return false and end right away.        else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget))            return false;        // Next, we need a group. So we define a group variable.        Group* groupTarget = NULL;        // We try to extract a group from an online player.        if (playerTarget)            groupTarget = playerTarget->GetGroup();        // If not, we extract it from the SQL.        if (!groupTarget)        {            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER);            stmt->setUInt32(0, guidTarget);            PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt);            if (resultGroup)                groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32());        }        // If both fails, players simply has no party. Return false.        if (!groupTarget)        {            handler->PSendSysMessage(LANG_GROUP_NOT_IN_GROUP, nameTarget.c_str());            handler->SetSentErrorMessage(true);            return false;        }        // We get the group members after successfully detecting a group.        Group::MemberSlotList const& members = groupTarget->GetMemberSlots();        // To avoid a cluster fuck, namely trying multiple queries to simply get a group member count...        handler->PSendSysMessage(LANG_GROUP_TYPE, (groupTarget->isRaidGroup() ? "raid" : "party"), members.size());        // ... we simply move the group type and member count print after retrieving the slots and simply output it's size.        // While rather dirty codestyle-wise, it saves space (if only a little). For each member, we look several informations up.        for (Group::MemberSlotList::const_iterator itr = members.begin(); itr != members.end(); ++itr)        {            // Define temporary variable slot to iterator.            Group::MemberSlot const& slot = *itr;            // Check for given flag and assign it to that iterator            std::string flags;            if (slot.flags & MEMBER_FLAG_ASSISTANT)                flags = "Assistant";            if (slot.flags & MEMBER_FLAG_MAINTANK)            {                if (!flags.empty())                    flags.append(", ");                flags.append("MainTank");            }            if (slot.flags & MEMBER_FLAG_MAINASSIST)            {                if (!flags.empty())                    flags.append(", ");                flags.append("MainAssist");            }            if (flags.empty())                flags = "None";            // Check if iterator is online. If is...            Player* p = ObjectAccessor::FindPlayer((*itr).guid);            if (p && p->IsInWorld())            {                // ... than, it prints information like "is online", where he is, etc...                onlineState = "online";                phase = (!p->IsGameMaster() ? p->GetPhaseMask() : -1);                uint32 locale = handler->GetSessionDbcLocale();                AreaTableEntry const* area = GetAreaEntryByAreaID(p->GetAreaId());                if (area)                {                    AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);                    if (zone)                        zoneName = zone->area_name[locale];                }            }//.........这里部分代码省略.........
开发者ID:Valurog,项目名称:TrinityCore,代码行数:101,


示例4: MAKE_NEW_GUID

//.........这里部分代码省略.........            last_ip = "-";            last_login = "-";        }    }    std::string nameLink = playerLink(target_name);    PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetSkyfireString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency);    std::string bannedby = "unknown";    std::string banreason = "";    if (QueryResult result2 = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned "                                                  "WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId))    {        Field* fields = result2->Fetch();        banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();        bannedby = fields[2].GetString();        banreason = fields[3].GetString();    }    else if (QueryResult result3 = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned "                                                           "WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid)))    {        Field* fields = result3->Fetch();        banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();        bannedby = fields[2].GetString();        banreason = fields[3].GetString();    }    if (muteTime > 0)        PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());    if (banTime >= 0)        PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());    std::string race_s, Class_s;    switch (race)    {        case RACE_HUMAN:            race_s = "Human";       break;        case RACE_ORC:              race_s = "Orc";         break;        case RACE_DWARF:            race_s = "Dwarf";       break;        case RACE_NIGHTELF:         race_s = "Night Elf";   break;        case RACE_UNDEAD_PLAYER:    race_s = "Undead";      break;        case RACE_TAUREN:           race_s = "Tauren";      break;        case RACE_GNOME:            race_s = "Gnome";       break;        case RACE_TROLL:            race_s = "Troll";       break;        case RACE_BLOODELF:         race_s = "Blood Elf";   break;        case RACE_DRAENEI:          race_s = "Draenei";     break;        case RACE_GOBLIN:           race_s = "Goblin";      break;        case RACE_WORGEN:           race_s = "Worgen";      break;    }    switch (Class)    {        case CLASS_WARRIOR:         Class_s = "Warrior";        break;        case CLASS_PALADIN:         Class_s = "Paladin";        break;        case CLASS_HUNTER:          Class_s = "Hunter";         break;        case CLASS_ROGUE:           Class_s = "Rogue";          break;        case CLASS_PRIEST:          Class_s = "Priest";         break;        case CLASS_DEATH_KNIGHT:    Class_s = "Death Knight";   break;        case CLASS_SHAMAN:          Class_s = "Shaman";         break;        case CLASS_MAGE:            Class_s = "Mage";           break;        case CLASS_WARLOCK:         Class_s = "Warlock";        break;        case CLASS_DRUID:           Class_s = "Druid";          break;    }    std::string timeStr = secsToTimeString(total_player_time, true, true);    uint32 gold = money /GOLD;    uint32 silv = (money % GOLD) / SILVER;    uint32 copp = (money % GOLD) % SILVER;    PSendSysMessage(LANG_PINFO_LEVEL, race_s.c_str(), Class_s.c_str(), timeStr.c_str(), level, gold, silv, copp);    // Add map, zone, subzone and phase to output    int locale = GetSessionDbcLocale();    std::string areaName = "<unknown>";    std::string zoneName = "";    MapEntry const* map = sMapStore.LookupEntry(mapId);    AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);    if (area)    {        areaName = area->area_name[locale];        AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);        if (zone)            zoneName = zone->area_name[locale];    }    if (target)    {        if (!zoneName.empty())            PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);        else            PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);    }    else        PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());    return true;}
开发者ID:SkyFireArchives,项目名称:SkyFireEMU_434,代码行数:101,


示例5: GetAreaEntryByAreaID

// Get water state on mapGridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data){    // Check water type (if no water return)    if (!m_liquidFlags && !m_liquidType)        return LIQUID_MAP_NO_WATER;    // Get cell    float cx = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);    float cy = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);    int x_int = (int)cx & (MAP_RESOLUTION - 1);    int y_int = (int)cy & (MAP_RESOLUTION - 1);    // Check water type in cell    int idx = (x_int>>3)*16 + (y_int>>3);    uint8 type = m_liquidFlags ? m_liquidFlags[idx] : m_liquidType;    uint32 entry = 0;    if (m_liquidEntry)    {        if (LiquidTypeEntry const* liquidEntry = sLiquidTypeStore.LookupEntry(m_liquidEntry[idx]))        {            entry = liquidEntry->Id;            type &= MAP_LIQUID_TYPE_DARK_WATER;            uint32 liqTypeIdx = liquidEntry->Type;            if (entry < 21)            {                if (AreaTableEntry const* area = sAreaStore.LookupEntry(getArea(x, y)))                {                    uint32 overrideLiquid = area->LiquidTypeOverride[liquidEntry->Type];                    if (!overrideLiquid && area->zone)                    {                        area = GetAreaEntryByAreaID(area->zone);                        if (area)                            overrideLiquid = area->LiquidTypeOverride[liquidEntry->Type];                    }                    if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid))                    {                        entry = overrideLiquid;                        liqTypeIdx = liq->Type;                    }                }            }            type |= 1 << liqTypeIdx;        }    }    if (type == 0)        return LIQUID_MAP_NO_WATER;    // Check req liquid type mask    if (ReqLiquidType && !(ReqLiquidType & type))        return LIQUID_MAP_NO_WATER;    // Check water level:    // Check water height map    int lx_int = x_int - m_liquid_offY;    if (lx_int < 0 || lx_int >= m_liquid_height)        return LIQUID_MAP_NO_WATER;    int ly_int = y_int - m_liquid_offX;    if (ly_int < 0 || ly_int >= m_liquid_width)        return LIQUID_MAP_NO_WATER;    // Get water level    float liquid_level = m_liquid_map ? m_liquid_map[lx_int * m_liquid_width + ly_int] : m_liquidLevel;    // Get ground level (sub 0.2 for fix some errors)    float ground_level = getHeight(x, y);    // Check water level and ground level    if (liquid_level < ground_level || z < ground_level - 2)        return LIQUID_MAP_NO_WATER;    // All ok in water -> store data    if (data)    {        data->entry = entry;        data->type_flags = type;        data->level = liquid_level;        data->depth_level = ground_level;    }    // For speed check as int values    int delta = int((liquid_level - z) * 10);    // Get position delta    if (delta > 20)                                         // Under water        return LIQUID_MAP_UNDER_WATER;    if (delta > 0)                                          // In water        return LIQUID_MAP_IN_WATER;    if (delta > -1)                                         // Walk on water        return LIQUID_MAP_WATER_WALK;    // Above water    return LIQUID_MAP_ABOVE_WATER;}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:100,


示例6: GetHeightStatic

GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data) const{    GridMapLiquidStatus result = LIQUID_MAP_NO_WATER;    VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();    uint32 liquid_type = 0;    float liquid_level = INVALID_HEIGHT_VALUE;    float ground_level = GetHeightStatic(x, y, z, true, DEFAULT_WATER_SEARCH);    if (vmgr->GetLiquidLevel(GetMapId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type))    {        // DEBUG_LOG("getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type);        // Check water level and ground level        if (liquid_level > ground_level && z > ground_level - 2)        {            // All ok in water -> store data            if (data)            {                // hardcoded in client like this                if (GetMapId() == 530 && liquid_type == 2)                    liquid_type = 15;                uint32 liquidFlagType = 0;                if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type))                    liquidFlagType = liq->Type;                if (liquid_type && liquid_type < 21)                {                    if (AreaTableEntry const* area = GetAreaEntryByAreaFlagAndMap(GetAreaFlag(x, y, z), GetMapId()))                    {                        uint32 overrideLiquid = area->LiquidTypeOverride[liquidFlagType];                        if (!overrideLiquid && area->zone)                        {                            area = GetAreaEntryByAreaID(area->zone);                            if (area)                                overrideLiquid = area->LiquidTypeOverride[liquidFlagType];                        }                        if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid))                        {                            liquid_type = overrideLiquid;                            liquidFlagType = liq->Type;                        }                    }                }                data->level = liquid_level;                data->depth_level = ground_level;                data->entry = liquid_type;                data->type_flags = 1 << liquidFlagType;            }            // For speed check as int values            int delta = int((liquid_level - z) * 10);            // Get position delta            if (delta > 20)                   // Under water                return LIQUID_MAP_UNDER_WATER;            if (delta > 0)                    // In water                return LIQUID_MAP_IN_WATER;            if (delta > -1)                   // Walk on water                return LIQUID_MAP_WATER_WALK;            result = LIQUID_MAP_ABOVE_WATER;        }    }    else if (GridMapPtr gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))    {        GridMapLiquidData map_data;        GridMapLiquidStatus map_result = gmap->getLiquidStatus(x, y, z, ReqLiquidType, &map_data);        // Not override LIQUID_MAP_ABOVE_WATER with LIQUID_MAP_NO_WATER:        if (map_result != LIQUID_MAP_NO_WATER && (map_data.level > ground_level))        {            if (data)            {                // hardcoded in client like this                if (GetMapId() == 530 && map_data.entry == 2)                    map_data.entry = 15;                *data = map_data;            }            return map_result;        }    }    return result;}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:84,


示例7: extractGuidFromLink

bool ChatHandler::HandleGPSCommand(const char* args){    WorldObject *obj = NULL;    if (*args)    {        uint64 guid = extractGuidFromLink((char*)args);        if (guid)            obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);        if (!obj)        {            SendSysMessage(LANG_PLAYER_NOT_FOUND);            SetSentErrorMessage(true);            return false;        }    }    else    {        obj = getSelectedUnit();        if (!obj)        {            SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);            SetSentErrorMessage(true);            return false;        }    }    CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());    Cell cell(cell_val);    uint32 zone_id, area_id;    obj->GetZoneAndAreaId(zone_id,area_id);    MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId());    AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);    AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);    float zone_x = obj->GetPositionX();    float zone_y = obj->GetPositionY();    Map2ZoneCoordinates(zone_x,zone_y,zone_id);    Map const *map = obj->GetMap();    float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);    float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());    GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY());    // 63? WHY?    int gx = 63 - p.x_coord;    int gy = 63 - p.y_coord;    uint32 have_map = Map::ExistMap(obj->GetMapId(),gx,gy) ? 1 : 0;    uint32 have_vmap = Map::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0;    if(have_vmap)    {        if(map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))            PSendSysMessage("You are outdoors");        else            PSendSysMessage("You are indoors");    }    else PSendSysMessage("no VMAP available for area info");    PSendSysMessage(LANG_MAP_POSITION,                    obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),                    zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>"),                    area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>"),                    obj->GetPhaseMask(),                    obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),                    cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),                    zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);    sLog->outDebug("Player %s GPS call for %s '%s' (%s: %u):",                   m_session ? GetNameLink().c_str() : GetTrinityString(LANG_CONSOLE_COMMAND),                   (obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(),                   (obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry()));    sLog->outDebug(GetTrinityString(LANG_MAP_POSITION),                   obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld->GetDefaultDbcLocale()] : "<unknown>"),                   zone_id, (zoneEntry ? zoneEntry->area_name[sWorld->GetDefaultDbcLocale()] : "<unknown>"),                   area_id, (areaEntry ? areaEntry->area_name[sWorld->GetDefaultDbcLocale()] : "<unknown>"),                   obj->GetPhaseMask(),                   obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),                   cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),                   zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);    LiquidData liquid_status;    ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);    if (res)    {        PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res);    }    return true;}
开发者ID:Erotix8210,项目名称:prydevserv_backup,代码行数:94,


示例8: ASSERT

//.........这里部分代码省略.........                        (*iter)->AddPassenger(plrMover);                        break;                    }                }                if (!foundNewTransport)                {                    plrMover->m_transport = NULL;                    movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);                    movementInfo.t_time = 0;                    movementInfo.t_seat = -1;                }            }        }        if (!mover->GetTransport() && !mover->GetVehicle())        {            GameObject* go = mover->GetMap()->GetGameObject(movementInfo.t_guid);            if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)                movementInfo.t_guid = 0;        }    }    else if (plrMover && plrMover->GetTransport())                // if we were on a transport, leave    {        plrMover->m_transport->RemovePassenger(plrMover);        plrMover->m_transport = NULL;        movementInfo.t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);        movementInfo.t_time = 0;        movementInfo.t_seat = -1;        movementInfo.t_guid = 0LL;    }    // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).    if (opcode == CMSG_MOVE_FALL_LAND && plrMover && !plrMover->isInFlight())    {        plrMover->HandleFall(movementInfo);    }    if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater())    {        // now client not include swimming flag in case jumping under water        plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));    }    // Hack Fix, clean emotes when moving    if (plrMover && plrMover->GetLastPlayedEmote())        plrMover->HandleEmoteCommand(0);    //if (plrMover)    //    sAnticheatMgr->StartHackDetection(plrMover, movementInfo, opcode);    uint32 mstime = getMSTime();    if (m_clientTimeDelay == 0)        m_clientTimeDelay = mstime - movementInfo.time;    movementInfo.time = movementInfo.time + m_clientTimeDelay + MOVEMENT_PACKET_TIME_DELAY;    movementInfo.guid = mover->GetGUID();    mover->m_movementInfo = movementInfo;    // this is almost never true (not sure why it is sometimes, but it is), normally use mover->IsVehicle()    if (mover->GetVehicle())    {        mover->SetOrientation(movementInfo.pos.GetOrientation());        return;    }    mover->UpdatePosition(movementInfo.pos);    /* process position-change */    WorldPacket data(SMSG_MOVE_UPDATE, recvPacket.size());    //movementInfo.Alive32 = movementInfo.time; // hack, but it's work in 505 in this way ...    mover->WriteMovementInfo(data);    mover->SendMessageToSet(&data, _player);        if (plrMover)                                            // nothing is charmed, or player charmed    {        plrMover->UpdateFallInformationIfNeed(movementInfo, opcode);        AreaTableEntry const* zone = GetAreaEntryByAreaID(plrMover->GetAreaId());        float depth = zone ? zone->MaxDepth : -500.0f;        if (movementInfo.pos.GetPositionZ() < depth)        {            if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player)))            {                // NOTE: this is actually called many times while falling                // even after the player has been teleported away                // TODO: discard movement packets after the player is rooted                if (plrMover->isAlive())                {                    plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());                    // player can be alive if GM/etc                    // change the death state to CORPSE to prevent the death timer from                    // starting in the next player update                    if (!plrMover->isAlive())                        plrMover->KillPlayer();                }            }        }    }}
开发者ID:Cailiaock,项目名称:5.4.7-Wow-source,代码行数:101,


示例9: bar

//.........这里部分代码省略.........                            continue;                        }                        if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask)                            sLog.outErrorEventAI("Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);                    }                    if (!temp.spell_hit.schoolMask)                        sLog.outErrorEventAI("Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);                    if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)                        sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_RANGE:                    if (temp.range.maxDist < temp.range.minDist)                        sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);                    if (temp.range.repeatMax < temp.range.repeatMin)                        sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_OOC_LOS:                    if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)                        sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_SPAWNED:                    switch (temp.spawned.condition)                    {                        case SPAWNED_EVENT_ALWAY:                            break;                        case SPAWNED_EVENT_MAP:                            if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))                                sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);                            break;                        case SPAWNED_EVENT_ZONE:                            if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))                                sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);                            break;                        default:                            sLog.outErrorEventAI("Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);                            break;                    }                    break;                case EVENT_T_FRIENDLY_HP:                    if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)                        sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_FRIENDLY_IS_CC:                    if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)                        sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_FRIENDLY_MISSING_BUFF:                {                    SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.friendly_buff.spellId);                    if (!pSpell)                    {                        sLog.outErrorEventAI("Creature %u has nonexistent SpellID(%u) defined in event %u.", temp.creature_id, temp.friendly_buff.spellId, i);                        continue;                    }                    if (temp.friendly_buff.radius <= 0)                    {                        sLog.outErrorEventAI("Creature %u has wrong radius (%u) for EVENT_T_FRIENDLY_MISSING_BUFF defined in event %u.", temp.creature_id, temp.friendly_buff.radius, i);                        continue;                    }                    if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)                        sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                }
开发者ID:KillaVulkan,项目名称:mangos-tbc,代码行数:67,


示例10: while

bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, std::string const& fullcmd){    char const* oldtext = text;    std::string cmd = "";    while (*text != ' ' && *text != '/0')    {        cmd += *text;        ++text;    }    while (*text == ' ') ++text;    for (uint32 i = 0; table[i].Name != NULL; ++i)    {        if (!hasStringAbbr(table[i].Name, cmd.c_str()))            continue;        bool match = false;        if (strlen(table[i].Name) > cmd.length())        {            for (uint32 j = 0; table[j].Name != NULL; ++j)            {                if (!hasStringAbbr(table[j].Name, cmd.c_str()))                    continue;                if (strcmp(table[j].Name, cmd.c_str()) == 0)                {                    match = true;                    break;                }            }        }        if (match)            continue;        // select subcommand from child commands list        if (table[i].ChildCommands != NULL)        {            if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd))            {                if (text[0] != '/0')                    SendSysMessage(LANG_NO_SUBCMD);                else                    SendSysMessage(LANG_CMD_SYNTAX);                ShowHelpForCommand(table[i].ChildCommands, text);            }            return true;        }        // must be available and have handler        if (!table[i].Handler || !isAvailable(table[i]))            continue;        SetSentErrorMessage(false);        // table[i].Name == "" is special case: send original command to handler        if ((table[i].Handler)(this, table[i].Name[0] != '/0' ? text : oldtext))        {            if (!m_session) // ignore console                return true;            Player* player = m_session->GetPlayer();            if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))            {                uint64 guid = player->GetTarget();                uint32 areaId = player->GetAreaId();                std::string areaName = "Unknown";                std::string zoneName = "Unknown";                if (AreaTableEntry const* area = GetAreaEntryByAreaID(areaId))                {                    areaName = area->area_name;                    if (AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone))                        zoneName = zone->area_name;                }                sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Guid: %u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected %s: %s (GUID: %u)]",                    fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),                    m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),                    player->GetPositionZ(), player->GetMapId(),                    player->GetMap() ? player->GetMap()->GetMapName() : "Unknown",                    areaId, areaName.c_str(), zoneName.c_str(), GetLogNameForGuid(guid),                    (player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",                    GUID_LOPART(guid));            }        }        // some commands have custom error messages. Don't send the default one in these cases.        else if (!HasSentErrorMessage())        {            if (!table[i].Help.empty())                SendSysMessage(table[i].Help.c_str());            else                SendSysMessage(LANG_CMD_SYNTAX);        }        return true;    }    return false;//.........这里部分代码省略.........
开发者ID:Sonyc1987,项目名称:SkyFire_5xx,代码行数:101,


示例11: ASSERT

//.........这里部分代码省略.........                {                    plrMover->m_transport = transport;                    transport->AddPassenger(plrMover);                }            }            else if (plrMover->GetTransport()->GetGUID() != movementInfo.transport.guid)            {                bool foundNewTransport = false;                plrMover->m_transport->RemovePassenger(plrMover);                if (Transport* transport = plrMover->GetMap()->GetTransport(movementInfo.transport.guid))                {                    foundNewTransport = true;                    plrMover->m_transport = transport;                    transport->AddPassenger(plrMover);                }                if (!foundNewTransport)                {                    plrMover->m_transport = NULL;                    movementInfo.ResetTransport();                }            }        }        if (!mover->GetTransport() && !mover->GetVehicle())        {            GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);            if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)                movementInfo.transport.guid = 0;        }    }    else if (plrMover && plrMover->GetTransport())                // if we were on a transport, leave    {        plrMover->m_transport->RemovePassenger(plrMover);        plrMover->m_transport = NULL;        movementInfo.ResetTransport();    }    // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).    if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->IsInFlight())        plrMover->HandleFall(movementInfo);    if (plrMover && ((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != plrMover->IsInWater())    {        // now client not include swimming flag in case jumping under water        plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()));    }    uint32 mstime = getMSTime();    /*----------------------*/    if (m_clientTimeDelay == 0)        m_clientTimeDelay = mstime - movementInfo.time;    /* process position-change */    movementInfo.time = movementInfo.time + m_clientTimeDelay + MOVEMENT_PACKET_TIME_DELAY;    movementInfo.guid = mover->GetGUID();    mover->m_movementInfo = movementInfo;    /*----------------------*/    /* process position-change */    // this is almost never true (not sure why it is sometimes, but it is), normally use mover->IsVehicle()    if (mover->GetVehicle())    {        mover->SetOrientation(movementInfo.pos.GetOrientation());        return;    }    mover->UpdatePosition(movementInfo.pos);    WorldPacket data(SMSG_PLAYER_MOVE, recvPacket.size());    mover->WriteMovementInfo(data);    mover->SendMessageToSet(&data, _player);    if (plrMover)                                            // nothing is charmed, or player charmed    {        plrMover->UpdateFallInformationIfNeed(movementInfo, opcode);        AreaTableEntry const* zone = GetAreaEntryByAreaID(plrMover->GetAreaId());        float depth = zone ? zone->MaxDepth : -500.0f;        if (movementInfo.pos.GetPositionZ() < depth)        {            if (!(plrMover->GetBattleground() && plrMover->GetBattleground()->HandlePlayerUnderMap(_player)))            {                // NOTE: this is actually called many times while falling                // even after the player has been teleported away                /// @todo discard movement packets after the player is rooted                if (plrMover->IsAlive())                {                    plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());                    // player can be alive if GM/etc                    // change the death state to CORPSE to prevent the death timer from                    // starting in the next player update                    if (!plrMover->IsAlive())                        plrMover->KillPlayer();                }            }        }    }}
开发者ID:happy-tree-friends,项目名称:Eluna-TC-Cata,代码行数:101,


示例12: HandleGPSCommand

    static bool HandleGPSCommand(ChatHandler* handler, const char *args)    {        WorldObject* obj = NULL;        if (*args)        {            uint64 guid = handler->extractGuidFromLink((char*)args);            if (guid)                obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);            if (!obj)            {                handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);                handler->SetSentErrorMessage(true);                return false;            }        }        else        {            obj = handler->getSelectedUnit();            if (!obj)            {                handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);                handler->SetSentErrorMessage(true);                return false;            }        }        CellCoord cell_val = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());        Cell cell(cell_val);        uint32 zone_id, area_id;        obj->GetZoneAndAreaId(zone_id, area_id);        MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId());        AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);        AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);        float zone_x = obj->GetPositionX();        float zone_y = obj->GetPositionY();        Map2ZoneCoordinates(zone_x, zone_y, zone_id);        Map const* map = obj->GetMap();        float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);        float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());        GridCoord p = Trinity::ComputeGridCoord(obj->GetPositionX(), obj->GetPositionY());        // 63? WHY?        int gx = 63 - p.x_coord;        int gy = 63 - p.y_coord;        uint32 have_map = Map::ExistMap(obj->GetMapId(), gx, gy) ? 1 : 0;        uint32 have_vmap = Map::ExistVMap(obj->GetMapId(), gx, gy) ? 1 : 0;        if (have_vmap)        {            if (map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))                handler->PSendSysMessage("You are outdoors");            else                handler->PSendSysMessage("You are indoors");        }        else handler->PSendSysMessage("no VMAP available for area info");        handler->PSendSysMessage(LANG_MAP_POSITION,            obj->GetMapId(), (mapEntry ? mapEntry->name : "<unknown>"),            zone_id, (zoneEntry ? zoneEntry->area_name : "<unknown>"),            area_id, (areaEntry ? areaEntry->area_name : "<unknown>"),            obj->GetPhaseMask(),            obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),            cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),            zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);        LiquidData liquid_status;        ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);        if (res)        {            handler->PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res);        }        return true;    }
开发者ID:Gosa1979,项目名称:ArkCORE2,代码行数:81,


示例13: HandleGoZoneXYCommand

    //teleport at coordinates    static bool HandleGoZoneXYCommand(ChatHandler* handler, char const* args)    {        if (!*args)            return false;        Player* player = handler->GetSession()->GetPlayer();        char* zoneX = strtok((char*)args, " ");        char* zoneY = strtok(NULL, " ");        char* tail = strtok(NULL, "");        char* id = handler->extractKeyFromLink(tail, "Harea");       // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r        if (!zoneX || !zoneY)            return false;        float x = (float)atof(zoneX);        float y = (float)atof(zoneY);        // prevent accept wrong numeric args        if ((x == 0.0f && *zoneX != '0') || (y == 0.0f && *zoneY != '0'))            return false;        uint32 areaId = id ? (uint32)atoi(id) : player->GetZoneId();        AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);        if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)        {            handler->PSendSysMessage(LANG_INVALID_ZONE_COORD, x, y, areaId);            handler->SetSentErrorMessage(true);            return false;        }        // update to parent zone if exist (client map show only zones without parents)        AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;        Map const* map = sMapMgr->CreateBaseMap(zoneEntry->mapid);        if (map->Instanceable())        {            handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[handler->GetSessionDbcLocale()], map->GetId(), map->GetMapName());            handler->SetSentErrorMessage(true);            return false;        }        Zone2MapCoordinates(x, y, zoneEntry->ID);        if (!MapManager::IsValidMapCoord(zoneEntry->mapid, x, y))        {            handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, zoneEntry->mapid);            handler->SetSentErrorMessage(true);            return false;        }        // stop flight if need        if (player->IsInFlight())        {            player->GetMotionMaster()->MovementExpired();            player->CleanupAfterTaxiFlight();        }        // save only in non-flight case        else            player->SaveRecallPosition();        float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));        player->TeleportTo(zoneEntry->mapid, x, y, z, player->GetOrientation());        return true;    }
开发者ID:Cashew,项目名称:TrinityCore,代码行数:71,


示例14: _FindConfig

void AntiCheat::DoAntiCheatAction(AntiCheatCheck checkType, std::string reason){    AntiCheatConfig const* config = _FindConfig(checkType);    if (!config)        return;    if (m_lastactiontime.find(checkType) == m_lastactiontime.end())        m_lastactiontime.insert(std::make_pair(checkType, 0));    if (WorldTimer::getMSTime() - m_lastactiontime[checkType] >= sWorld.getConfig(CONFIG_UINT32_ANTICHEAT_ACTION_DELAY) * 1000)    {        m_lastactiontime[checkType] = WorldTimer::getMSTime();        std::string name = GetPlayer()->GetName();        std::string namechat;        MapEntry const* mapEntry = sMapStore.LookupEntry(GetPlayer()->GetMapId());        uint32 zone_id, area_id;        GetPlayer()->GetZoneAndAreaId(zone_id,area_id);        AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id);        AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id);        char buffer[255];        namechat.clear();        namechat.append(" |cddff0000|Hplayer:");        namechat.append(name);        namechat.append("|h[");        namechat.append(name);        namechat.append("]|h|r ");        sprintf(buffer," Map %u (%s), Zone %u (%s) Area |cbbdd0000|Harea:%u|h[%s]|h|r ",        GetPlayer()->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ),        zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ),        area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ));        if (m_currentspellID)        {            SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_currentspellID);            if (spellInfo)                sprintf(buffer,", last spell |cbbee0000|Hspell:%u|h[%s]|h|r  ",                    m_currentspellID, spellInfo->SpellName[sWorld.GetDefaultDbcLocale()]);        }        namechat.append(buffer);        for (int i=0; i < ANTICHEAT_ACTIONS; ++i )        {            AntiCheatAction actionID = AntiCheatAction(config->actionType[i]);            switch(actionID)            {                case    ANTICHEAT_ACTION_KICK:                        GetPlayer()->GetSession()->KickPlayer();                break;                case    ANTICHEAT_ACTION_BAN:                    sWorld.BanAccount(BAN_CHARACTER, name.c_str(), config->actionParam[i], reason, "AntiCheat");                break;                case    ANTICHEAT_ACTION_SHEEP:                    {                        uint32 sheepAura = 28272;                        switch (urand(0,6))                        {                            case 0:                                sheepAura = 118;                            break;                            case 1:                                sheepAura = 28271;                            break;                            case 2:                                sheepAura = 28272;                            break;                            case 3:                                sheepAura = 61025;                            break;                            case 4:                                sheepAura = 61721;                            break;                            case 5:                                sheepAura = 71319;                            break;                            default:                            break;                        }                        GetPlayer()->_AddAura(sheepAura,config->actionParam[i]);                        if (checkType == CHECK_MOVEMENT_FLY ||                            GetPlayer()->HasAuraType(SPELL_AURA_FLY))                            {                                GetPlayer()->CastSpell(GetPlayer(), 55001, true);                            }                    }                break;                case    ANTICHEAT_ACTION_STUN:                        GetPlayer()->_AddAura(13005,config->actionParam[i]);                break;                case    ANTICHEAT_ACTION_SICKNESS://.........这里部分代码省略.........
开发者ID:Lightunit,项目名称:mangos,代码行数:101,


示例15: bar

//.........这里部分代码省略.........                            continue;                        }                        if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask)                            sLog.outErrorDb("CreatureEventAI:  Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);                    }                    if (!temp.spell_hit.schoolMask)                        sLog.outErrorDb("CreatureEventAI:  Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);                    if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_RANGE:                    if (temp.range.maxDist < temp.range.minDist)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);                    if (temp.range.repeatMax < temp.range.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_OOC_LOS:                    if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_SPAWNED:                    switch(temp.spawned.condition)                    {                        case SPAWNED_EVENT_ALWAY:                            break;                        case SPAWNED_EVENT_MAP:                            if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))                                sLog.outErrorDb("CreatureEventAI:  Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);                            break;                        case SPAWNED_EVENT_ZONE:                            if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))                                sLog.outErrorDb("CreatureEventAI:  Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);                        default:                            sLog.outErrorDb("CreatureEventAI:  Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);                            break;                    }                    break;                case EVENT_T_FRIENDLY_HP:                    if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_FRIENDLY_IS_CC:                    if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_FRIENDLY_MISSING_BUFF:                {                    SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);                    if (!pSpell)                    {                        sLog.outErrorDb("CreatureEventAI:  Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);                        continue;                    }                    if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                }                case EVENT_T_KILL:                    if (temp.kill.repeatMax < temp.kill.repeatMin)                        sLog.outErrorDb("CreatureEventAI:  Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);                    break;                case EVENT_T_TARGET_CASTING:                    if (temp.target_casting.repeatMax < temp.target_casting.repeatMin)
开发者ID:Elevim,项目名称:RG-332,代码行数:67,


示例16: TC_LOG_ERROR

bool SmartAIMgr::IsEventValid(SmartScriptHolder& e){    if (e.event.type >= SMART_EVENT_END)    {        TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());        return false;    }    // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core    if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1]))    {        TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());        return false;    }    if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END)    {        TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());        return false;    }    if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)    {        TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);        return false;    }    if (e.event.event_flags > SMART_EVENT_FLAGS_ALL)    {        TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);        return false;    }    if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)    {        e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script!        if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))            return false;        if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))            return false;    }    else    {        uint32 type = e.event.type;        switch (type)        {            case SMART_EVENT_UPDATE:            case SMART_EVENT_UPDATE_IC:            case SMART_EVENT_UPDATE_OOC:            case SMART_EVENT_HEALT_PCT:            case SMART_EVENT_MANA_PCT:            case SMART_EVENT_TARGET_HEALTH_PCT:            case SMART_EVENT_TARGET_MANA_PCT:            case SMART_EVENT_RANGE:            case SMART_EVENT_DAMAGED:            case SMART_EVENT_DAMAGED_TARGET:            case SMART_EVENT_RECEIVE_HEAL:                if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))                    return false;                if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))                    return false;                break;            case SMART_EVENT_SPELLHIT:            case SMART_EVENT_SPELLHIT_TARGET:                if (e.event.spellHit.spell)                {                    SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);                    if (!spellInfo)                    {                        TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);                        return false;                    }                    if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)                    {                        TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);                        return false;                    }                }                if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax))                    return false;                break;            case SMART_EVENT_OOC_LOS:            case SMART_EVENT_IC_LOS:                if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax))                    return false;                break;            case SMART_EVENT_RESPAWN:                if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))                {                    TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);                    return false;                }                if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area))                {                    TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);                    return false;                }                break;            case SMART_EVENT_FRIENDLY_HEALTH:                if (!NotNULL(e, e.event.friendlyHealth.radius))                    return false;                if (!IsMinMaxValid(e, e.event.friendlyHealth.repeatMin, e.event.friendlyHealth.repeatMax))//.........这里部分代码省略.........
开发者ID:3306665,项目名称:trinitycore,代码行数:101,



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


C++ GetAreaFlagByAreaID函数代码示例
C++ GetArea函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。