Jump to content

kerhong

Members
  • Posts

    11
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by kerhong

  1. MMORPG server emulating step by step:

    #1 Do single action over and over again while logging packets

    #2 Check witch packet got sent same amount of times as you did your action

    #3 Reverse-engineer packet structure (disassemble client or do similar action so the same opcode gets sent only with slightly different data)

    #4 Create such feature for your emulator

    Usually you should start with movement handling and then go in more difficult directions.

    That's the very very short and simple version

  2. Why would you call it 'hack'?

    • Client sends OS data only to authserver, so the operating system detection can't be handled in worldserver
    • The value must be stored in database, because all data from authserver to worldserver is sent this way
    • Storing plain string instead of comparing it to known operating systems and storing some ID of the OS is better, because there could be more possible values other than "Win" and "OSX"

    The 'if (ch->os[n]) operatingSystem.push_back(ch->os[n]);' part could be done without IFs or in loop, but really checking if byte is zero is faster than pushing 0 in end of string.

  3. Not tested but should answer what you ask

    // Add this in Player.h
    struct DamageHealData
    {
       DamageHealData() : damage(0), healing(0) { }
    
       uint32 damage;
       uint32 healing;
    };
    
    // Add this to Player class
    std::map<uint64, DamageHealData*> m_DamagersAndHealers;
    
    // Unit::DealDamage
    if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
       ((Player*)pVictim)->DamagedOrHealed(GetGUID(), damage, 0);
    
    // Unit::DealHeal
    if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
       ((Player*)pVictim)->DamagedOrHealed(GetGUID(), 0, addhealth);
    
    // Unit::ClearInCombat
    if (GetTypeId() == TYPEID_PLAYER)
    {
       Player *p = ((Player*)this);
    
       for (std::map<uint64, DamageHealData*>::iterator itr = p->m_DamagersAndHealers.begin(); itr != p->m_DamagersAndHealers.end(); ++itr)
           delete itr->second;
       p->m_DamagersAndHealers.clear();
    }
    
    void Player::DamagedOrHealed(uint64 guid, uint32 damage, uint32 heal)
    {
       DamageHealData *data = NULL;
       if (!data = m_DamagersAndHealers[guid])
           m_DamagersAndHealers[guid] = new DamageHealData();
    
       data->damage += damage;
       data->healing += heal;
    }
    
    // Example
    for (std::map<uint64, DamageHealData*>::iterator itr = m_DamagersAndHealers.begin(); itr != m_DamagersAndHealers.end(); ++itr)
    {
       if (itr->second->damage > itr->second->healing)
           sLog->outString("Player with GUID %u is damager");
       else
           sLog->outString("Player with GUID %u is healer");
    }

  4. All orientation in Mangos is done in radians, 1 radian = 180 degrees

    Max value of orientation is 2M_PI (3.14*2 = ~6.28) witch alseo equals 0 (2 radians are full cycle)

    To turn right you need to substract 'value' from current orientation.

    30 degrees = M_PI / 6

    So the new orientation would be 'o - value' (if the value is given in radians)

    Also this rule should be followed:

    0 < orientation < 2M_PI

    This should work:

    if (orientation < 0.0f)
     orientation += 2.0f * M_PI;
    else if (orientation > 2* M_PI)
     orientation -= 2.0f * M_PI;

    Turning around would be 'o - M_PI'

    Degrees to radians can be converted with 'radians = degrees * M_PI / 180.0f'

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use