Пример #1
0
bool GameObjectModel::Relocate(const GameObject& go)
{
    if (!iModel)
        return false;

    ModelList::const_iterator it = model_list.find(go.GetDisplayId());
    if (it == model_list.end())
        return false;

    G3D::AABox mdl_box(it->second.bound);
    // ignore models with no bounds
    if (mdl_box == G3D::AABox::zero())
    {
        VMAP_ERROR_LOG("misc", "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
        return false;
    }

    iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ());

    G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(go.GetOrientation(), 0, 0);
    iInvRot = iRotation.inverse();
    // transform bounding box:
    mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale);
    AABox rotated_bounds;
    for (int i = 0; i < 8; ++i)
        rotated_bounds.merge(iRotation * mdl_box.corner(i));

    iBound = rotated_bounds + iPos;
#ifdef SPAWN_CORNERS
    // test:
    for (int i = 0; i < 8; ++i)
    {
        Vector3 pos(iBound.corner(i));
        go.SummonCreature(1, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN);
    }
#endif

    return true;
}
Пример #2
0
bool ChatHandler::HandleGOInfo(const char *args, WorldSession *m_session)
{
    std::stringstream sstext;
    GameObject *GObj = NULL;

    GObj = m_session->GetPlayer()->m_GM_SelectedGO;
    if( !GObj )
    {
        RedSystemMessage(m_session, "No selected GameObject...");
        return true;
    }

    WhiteSystemMessage(m_session, "Information:");
    if(GObj->m_spawn)
        GreenSystemMessage(m_session, "SpawnID: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->m_spawn->id);
    GreenSystemMessage(m_session, "Entry: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetEntry());
    GreenSystemMessage(m_session, "Model: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetDisplayId());
    GreenSystemMessage(m_session, "State: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetState());
    GreenSystemMessage(m_session, "flags: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetFlags());
    GreenSystemMessage(m_session, "dynflags: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_DYNAMIC));
    GreenSystemMessage(m_session, "faction: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_FACTION));

    std::stringstream gottext;
    uint8 type = GObj->GetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_TYPE_ID);
    switch(type)
    {
    case GAMEOBJECT_TYPE_DOOR:
        gottext << "Door";
        break;
    case GAMEOBJECT_TYPE_BUTTON:
        gottext << "Button";
        break;
    case GAMEOBJECT_TYPE_QUESTGIVER:
        gottext << "Quest Giver";
        break;
    case GAMEOBJECT_TYPE_CHEST:
        gottext << "Chest";
        break;
    case GAMEOBJECT_TYPE_BINDER:
        gottext << "Binder";
        break;
    case GAMEOBJECT_TYPE_GENERIC:
        gottext << "Generic";
        break;
    case GAMEOBJECT_TYPE_TRAP:
        gottext << "Trap";
        break;
    case GAMEOBJECT_TYPE_CHAIR:
        gottext << "Chair";
        break;
    case GAMEOBJECT_TYPE_SPELL_FOCUS:
        gottext << "Spell Focus";
        break;
    case GAMEOBJECT_TYPE_TEXT:
        gottext << "Text";
        break;
    case GAMEOBJECT_TYPE_GOOBER:
        gottext << "Goober";
        break;
    case GAMEOBJECT_TYPE_TRANSPORT:
        gottext << "Transport";
        break;
    case GAMEOBJECT_TYPE_AREADAMAGE:
        gottext << "Area Damage";
        break;
    case GAMEOBJECT_TYPE_CAMERA:
        gottext << "Camera";
        break;
    case GAMEOBJECT_TYPE_MAP_OBJECT:
        gottext << "Map Object";
        break;
    case GAMEOBJECT_TYPE_MO_TRANSPORT:
        gottext << "Mo Transport";
        break;
    case GAMEOBJECT_TYPE_DUEL_ARBITER:
        gottext << "Duel Arbiter";
        break;
    case GAMEOBJECT_TYPE_FISHINGNODE:
        gottext << "Fishing Node";
        break;
    case GAMEOBJECT_TYPE_RITUAL:
        gottext << "Ritual";
        break;
    case GAMEOBJECT_TYPE_MAILBOX:
        gottext << "Mailbox";
        break;
    case GAMEOBJECT_TYPE_AUCTIONHOUSE:
        gottext << "Auction House";
        break;
    case GAMEOBJECT_TYPE_GUARDPOST:
        gottext << "Guard Post";
        break;
    case GAMEOBJECT_TYPE_SPELLCASTER:
        gottext << "Spell Caster";
        break;
    case GAMEOBJECT_TYPE_MEETINGSTONE:
        gottext << "Meeting Stone";
        break;
    case GAMEOBJECT_TYPE_FLAGSTAND:
        gottext << "Flag Stand";
        break;
    case GAMEOBJECT_TYPE_FISHINGHOLE:
        gottext << "Fishing Hole";
        break;
    case GAMEOBJECT_TYPE_FLAGDROP:
        gottext << "Flag Drop";
        break;
    case GAMEOBJECT_TYPE_MINI_GAME:
        gottext << "Mini Game";
        break;
    case GAMEOBJECT_TYPE_LOTTERY_KIOSK:
        gottext << "Lottery KIOSK";
        break;
    case GAMEOBJECT_TYPE_CAPTURE_POINT:
        gottext << "Capture Point";
        break;
    case GAMEOBJECT_TYPE_AURA_GENERATOR:
        gottext << "Aura Generator";
        break;
    case GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY:
        gottext << "Dungeon Difficulty";
        break;
    case GAMEOBJECT_TYPE_BARBER_CHAIR:
        gottext << "Barber Chair";
        break;
    case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
        gottext << "Destructible Building";
        break;
    case GAMEOBJECT_TYPE_GUILD_BANK:
        gottext << "Guild Bank";
        break;
    case GAMEOBJECT_TYPE_TRAPDOOR:
        gottext << "Trap Door";
        break;
    default:
        gottext << "Unknown.";
        break;
    }
    GreenSystemMessage(m_session, "Type: %s%u|r -- %s", MSG_COLOR_LIGHTBLUE, type, gottext.str().c_str());
    GreenSystemMessage(m_session, "Distance: %s%f|r", MSG_COLOR_LIGHTBLUE, GObj->CalcDistance((Object*)m_session->GetPlayer()));
    GreenSystemMessage(m_session, "Size: %s%f|r", MSG_COLOR_LIGHTBLUE, GObj->GetFloatValue(OBJECT_FIELD_SCALE_X));
    if(GObj->GetInfo())
        GreenSystemMessage(m_session, "Name: %s%s|r", MSG_COLOR_LIGHTBLUE, GObj->GetInfo()->Name);
    GreenSystemMessage(m_session, "Phase: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetPhaseMask());
    SystemMessage(m_session, sstext.str().c_str());
    return true;
}