YENİ PET.CPP ve PAKETLERİ

Konusu 'Kaynak Kod Paylaşımları' forumundadır ve tancan78 tarafından 2 Temmuz 2018 başlatılmıştır.

  1. Çevrim Dışı
    Staff Member
    tancan78

    tancan78 Moderator

    • Mesajlar:  59
    • Beğenilen Mesajlarınız:0
    16 Haziran 2018
    Cinsiyet:
    Bay
    Bulunduğu Yer
    Bursa
    Pet.cpp dosyası

    [hide]
    Kod:
    #include "stdafx.h"
    #include "Map.h"
    #include "DBAgent.h"
    
    // Pet System by Obede
    CPet::CPet() : Unit(UnitType::UnitPet)
    {
    CPet::Initialize();
    }
    
    void CPet::Initialize()
    {
    memset(m_sItemArray, 0x00, sizeof(m_sItemArray));
    m_isBusy = false;
    m_byLevelUP = false;
    m_UserID = -1;
    m_sSid = 0;
    m_sPid = 0;
    m_sSize = 100;
    m_PetName.clear();
    m_plastSaveTime = UNIXTIME;
    m_SatisfTime = UNIXTIME;
    m_iSellingGroup = 0;
    m_fTotalHitrate = 0;
    m_fTotalEvasionrate = 0;
    m_sTotalAc = 0;
    m_sTotalHit = 0;
    m_byDirection = 0;
    m_iWeapon_1 = 0;
    m_iWeapon_2 = 0;
    m_oSocketID = -1;
    m_bEventRoom = 0;
    m_PetState = PET_UNSUMMON;
    m_iExp = 0;
    m_bLevel = 0;
    m_bClass = 0;
    m_bNation = 0;
    m_sSatisfaction = 0;
    m_Serial = 0;
    m_sMaxHp = 0;
    m_sMaxMp = 0;
    m_sHp = 0;
    m_sMp = 0;
    m_TargetID = -1;
    m_ThreadTime = UNIXTIME;
    m_sAttack = 0;
    m_sAc = 0;
    m_bResistanceBonus = 0;
    m_sFireR = m_sColdR = m_sLightningR = m_sMagicR = m_sDiseaseR = m_sPoisonR = 0;
    m_Mode = PET_STATE_ATTACK;
    m_Function = PET_FUNC_NONE;
    LastStep = 1;
    LastMovedTime = 0;
    Unit::Initialize();
    }
    
    void CPet::Update()
    {
    if ((UNIXTIME - m_plastSaveTime) >= PET_SAVE_INTERVAL)
    PetSaveDataRequest();
    
    if ((UNIXTIME - m_SatisfTime) >= SATISF_DAMAGE_INTERVAL)
    {
    m_SatisfTime = UNIXTIME;
    SatisfactionChange(-10);
    }
    
    CheckUserOnline();
    }
    
    void CPet::HandleStateChange(Packet & pkt)
    {
    uint8 RecvMode;
    pkt >> RecvMode;
    if (RecvMode == PET_MODE_LOOTING)
    {
    if (!CheckExistItem(ITEM_AUTO_LOOTING))
    return;
    }
    
    m_Mode = RecvMode;
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_CHANGE) << RecvMode << uint16(1);
    Send(&result);
    }
    
    void CPet::HandleSatisfaction(Packet & pkt)
    {
    CUser * pUser = g_pMain->GetUserPtr(GetUserID());
    if (pUser != nullptr)
    {
    uint8 RecvSlot, nType;
    uint32 nSendSatis;
    uint32 RecvItemID;
    pkt >> RecvSlot >> RecvItemID >> nType;
    if (RecvItemID != ITEM_LEAF && RecvItemID != ITEM_BREAD && RecvItemID != ITEM_MILK)
    return;
    
    _ITEM_DATA * pItem = pUser->GetItem(RecvSlot + SLOT_MAX);
    pItem->sCount--;
    if (pItem->sCount <= 0)
    memset(pItem, 0, sizeof(pItem));
    
    if (RecvItemID == ITEM_LEAF)
    nSendSatis = SETISF_LEAF;
    else if (RecvItemID == ITEM_BREAD)
    nSendSatis = SETISF_BREAD;
    else if (RecvItemID == ITEM_MILK)
    nSendSatis = SETISF_MILK;
    
    SatisfactionChange(nSendSatis, RecvSlot, RecvItemID, nType, pItem->sCount);
    }
    }
    
    void CPet::PetSaveDataRequest()
    {
    m_plastSaveTime = UNIXTIME;
    g_DBAgent.UpdatePetData(this);
    }
    
    void CPet::SendMoveResult(float fX, float fY, float fZ, float fSpeed /*= 0.0f*/)
    {
    Packet result(MOVE_RESULT, uint8(SUCCESS));
    result << GetID() << fX << fZ << fY << fSpeed;
    g_pMain->Send_AIServer(&result);
    }
    
    void CPet::Moving(float toX, float toY, float toZ, uint8 Speed)
    {
    CNpc * pNpc = g_pMain->GetNpcPtr(GetID());
    if (pNpc != nullptr)
    {
    pNpc->SetPosition(toX, toY, toZ);
    pNpc->RegisterRegion();
    SendMoveResult(toX, toY, toZ, Speed);
    Packet result2(WIZ_NPC_MOVE);
    result2 << uint8(Speed) << GetID() << pNpc->GetSPosX() << pNpc->GetSPosZ() << pNpc->GetSPosY() << uint16(1);
    pNpc->SendToRegion(&result2);
    LastMovedTime = uint32(UNIXTIME);
    }
    
    m_Oldx = m_curx;
    m_Oldz = m_curz;
    
    m_curx = toX;
    m_curz = toZ;
    }
    
    void CPet::PetItemGet(_PET_BUNDLE * pBundle)
    {
    if (pBundle == nullptr)
    return;
    
    for (int i = 0; i < NPC_HAVE_ITEM_LIST; i++)
    {
    if (pBundle->mItem == 0)
    continue;
    
    CUser * pUser = g_pMain->GetUserPtr(GetUserID());
    if (pUser != nullptr)
    {
    Packet pItem;
    pItem << pBundle->BundleID
    << pBundle->mItem
    << pBundle->mCount
    << uint16(i)
    << uint8(1);
    
    pUser->ItemGet(pItem);
    }
    }
    
    if(g_pMain->m_PetBundleArray.find(pBundle->BundleID) != g_pMain->m_PetBundleArray.end())
    g_pMain->m_PetBundleArray.erase(pBundle->BundleID);
    
    if (g_pMain->m_PetBundleArray.size() == 0)
    {
    m_isBusy = false;
    CUser * pUser = g_pMain->GetUserPtr(GetUserID());
    if (pUser != nullptr)
    {
    float x, z;
    if (m_curx < pUser->m_oldx || m_curx == pUser->m_oldx)
    x = pUser->m_curx - 1;
    else
    x = pUser->m_curx + 1;
    
    if (m_curz < pUser->m_oldz || m_curz == pUser->m_oldz)
    z = pUser->m_curz - 1;
    else
    z = pUser->m_curz + 1;
    
    Moving(x, m_cury, z, uint8(30));
    }
    }
    }
    
    void CPet::SummonPet(CUser * pSessionz, uint32 nItemNum)
    {
    _ITEM_PET * pItem = g_pMain->m_ItemPetArray.GetData(nItemNum);
    _ITEM_TABLE * pTable = g_pMain->m_ItemtableArray.GetData(nItemNum);
    if (pItem != nullptr && pSessionz != nullptr && pTable != nullptr)
    {
    pSessionz->SummonPetID = m_Serial;
    m_UserID = pSessionz->GetSocketID();
    m_OwnerName = pSessionz->GetName();
    m_bClass = pItem->pClass;
    m_ItemID = nItemNum;
    m_sNid = -1; // Only Receive Nid after Aiserver Created and send back
    m_sSid = pItem->pSid;
    m_sPid = pItem->pPid;
    m_sSize = pItem->pSize;
    m_iWeapon_1 = m_iWeapon_2 = 0;
    m_bZone = pSessionz->GetZoneID();
    m_byDirection = 45;
    m_oSocketID = pSessionz->GetID();
    m_bEventRoom = pSessionz->GetEventRoom();
    m_Mode = PET_MODE_ATTACK;
    m_Function = PET_FUNC_NONE;
    
    g_pMain->SpawningtPet(m_Serial, m_bLevel, m_iExp, m_sPid, m_sSize, pSessionz->GetZoneID(), pSessionz->m_curx, pSessionz->m_cury, pSessionz->m_curz, pSessionz->GetNation(), pSessionz->GetSocketID(), pSessionz->GetEventRoom());
    }
    }
    
    void CPet::HpChange(int amount, Unit* pAttacker, bool bSendToAI)
    {
    int16 nAttacker = pAttacker != nullptr ? pAttacker->GetID() : -1;
    
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_HPCHANGE) << uint16(GetMaxHealth()) << uint16(GetHealth()) << nAttacker;
    Send(&result);
    }
    
    void CPet::SetPetAbility()
    {
    m_sTotalAc = m_sAc = 5 * m_bLevel + (25 * (25 * m_bLevel) / 100);
    m_sTotalHit = m_sAttack = 3 * m_bLevel + (10 * (5 * m_bLevel) / 100);
    m_sHp = m_sMaxHp = 15 * m_bLevel + (25 * (30 * m_bLevel) / 100);
    m_sMp = m_sMaxMp = 10 * m_bLevel + (25 * (30 * m_bLevel) / 100);
    m_sFireR = m_sColdR = m_sLightningR = 3 * m_bLevel + (5 * (5 * m_bLevel) / 100);
    m_sMagicR = m_sDiseaseR = m_sPoisonR = 3 * m_bLevel + (5 * (5 * m_bLevel) / 100);
    }
    
    void CPet::OnDeath()
    {
    CNpc * pNpc = g_pMain->GetNpcPtr(GetID());
    if (pNpc == nullptr || pNpc->m_NpcState == NPC_DEAD)
    return;
    
    ASSERT(pNpc->GetMap() != nullptr);
    ASSERT(pNpc->GetRegion() != nullptr);
    
    pNpc->m_NpcState = NPC_DEAD;
    pNpc->m_sACPercent = 100;
    
    pNpc->SendDeathAnimation();
    
    /*Packet result(WIZ_NPC_INOUT, uint8(INOUT_OUT));
    result << GetID();
    pNpc->SendToRegion(&result);*/
    
    pNpc->GetRegion()->Remove(pNpc);
    pNpc->SetRegion();
    
    Dead();
    }
    
    void CPet::Dead()
    {
    PetSaveDataRequest();
    m_PetState = PET_UNSUMMON;
    m_UserID = -1;
    g_pMain->KillNpc(GetID());
    }
    
    void CPet::HpChangeMagic(int amount, Unit* pAttacker, AttributeType attributeType)
    {
    
    }
    
    void CPet::ExpChange(int64 amount)
    {
    uint64 MaxEXP = g_pMain->GetPetExpByLevel(m_bLevel);
    m_iExp += amount;
    
    if (m_iExp < 0)
    m_iExp = 0;
    
    else if (m_iExp > MaxEXP && m_bLevel < MAX_LEVEL_PET)
    {
    m_byLevelUP = true;
    m_iExp -= MaxEXP;
    m_bLevel++;
    }
    else if (m_iExp > MaxEXP && m_bLevel == MAX_LEVEL_PET)
    m_iExp = MaxEXP;
    
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_EXP) << uint64(amount) << uint16((m_iExp * 10000) / g_pMain->GetPetExpByLevel(m_bLevel)) << m_bLevel << m_sSatisfaction;
    Send(&result);
    
    if (m_byLevelUP)
    {
    SetPetAbility();
    SendMyInfo();
    PetSaveDataRequest();
    }
    }
    
    void CPet::MSpChange(int amount)
    {
    m_sMp += amount;
    if (m_sMp < 0)
    m_sMp = 0;
    else if (m_sMp > m_sMaxMp)
    m_sMp = m_sMaxMp;
    
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_MP) << uint16(m_sMaxMp) << uint16(m_sMp);
    Send(&result);
    }
    
    void CPet::SendMyInfo()
    {
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_CHANGE)
    << uint8(1)
    << uint8(1)
    << uint8(0)
    << m_Serial
    << GetName()
    << m_bClass
    << GetLevel()
    << uint16((m_iExp * 10000) / g_pMain->GetPetExpByLevel(m_bLevel))
    << uint16(GetMaxHealth()) << uint16(GetHealth())
    << uint16(GetMaxMana()) << uint16(GetMana())
    << m_sSatisfaction
    << m_sAttack << m_sAc
    << uint8(m_sFireR) << uint8(m_sColdR) << uint8(m_sLightningR)
    << uint8(m_sMagicR) << uint8(m_sDiseaseR) << uint8(m_sPoisonR);
    
    for (int i = 0; i < PET_ITEM_MAX; i++)
    {
    _ITEM_DATA * pItem = &m_sItemArray;
    
    result << pItem->nNum
    << pItem->sDuration
    << pItem->sCount
    << pItem->bFlag
    << pItem->sRemainingRentalTime
    << uint32(0)
    << pItem->nExpirationTime;
    }
    
    Send(&result);
    
    if (m_byLevelUP)
    {
    m_byLevelUP = false;
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_LEVELUP) << GetID();
    Send(&result);
    }
    }
    
    void CPet::UpdatePetItem()
    {
    Packet result(WIZ_PET, uint8(1));
    result.DByte();
    result << uint8(PET_STATE_ITEM) << m_Serial << m_PetName << m_bClass << m_bLevel << uint16((m_iExp * 10000) / g_pMain->GetPetExpByLevel(m_bLevel)) << m_sSatisfaction;
    Send(&result);
    }
    
    void CPet::SatisfactionChange(int16 amount, uint8 RecvSlot, uint32 RecvItemID, uint8 RecvType, uint16 nCount)
    {
    uint16 SatisfPercent;
    uint16 Old_Satisf = m_sSatisfaction;
    
    m_sSatisfaction += amount;
    if (m_sSatisfaction < 0)
    m_sSatisfaction = 0;
    else if (m_sSatisfaction > SATISF_MAX)
    {
    m_sSatisfaction = SATISF_MAX;
    SatisfPercent = SATISF_MAX - Old_Satisf;
    }
    else
    SatisfPercent = amount;
    
    if (amount > 0)
    {
    // 76 01 10 01 03 D05D3817 0000 0000 00000000 E803
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_SATISF_GAIN)
    << uint8(1)
    << RecvType
    << RecvItemID
    << nCount
    << uint16(1)
    << uint32(0)
    << SatisfPercent;
    
    Send(&result);
    }
    
    // 76 01 0F 1027 B13E
    Packet resultb(WIZ_PET, uint8(1));
    resultb << uint8(PET_STATE_SATISF) << m_sSatisfaction << GetID();
    Send(&resultb);
    }
    
    void CPet::CheckUserOnline()
    {
    CUser * pUser = g_pMain->GetUserPtr(GetUserID());
    if (pUser == nullptr || !pUser->isInGame())
    OnDeath();
    }
    
    bool CPet::CheckExistItem(uint32 itemid, uint16 count /*= 1*/)
    {
    for (int i = 0; i < PET_ITEM_MAX; i++)
    {
    if (m_sItemArray.nNum == itemid
    && m_sItemArray.sCount >= count)
    return true;
    }
    
    return false;
    }
    
    void CPet::Send(Packet * pkt)
    {
    CUser * pUser = g_pMain->GetUserPtr(GetUserID());
    if (pUser == nullptr)
    return;
    
    pUser->Send(pkt);
    }
    
    void CPet::SendNpcRegion(Packet * pkt)
    {
    CNpc * pNpc = g_pMain->GetNpcPtr(GetID());
    if (pNpc == nullptr)
    return;
    
    pNpc->SendToRegion(pkt);
    }
    
    void CPet::SendUserRegion(Packet * pkt)
    {
    CUser * pUser = g_pMain->GetUserPtr(GetUserID());
    if (pUser == nullptr)
    return;
    
    pUser->SendToRegion(pkt, nullptr, GetEventRoom());
    }
    
    bool CPet::isInRange(float fx, float fz, float fSquaredRange)
    {
    return (GetDistance(fx, fz) <= fSquaredRange);
    }
    
    float CPet::GetDistance(float fx, float fz)
    {
    return (float)GetDistance(GetX(), GetZ(), fx, fz);
    }
    
    float CPet::GetDistance(float fStartX, float fStartZ, float fEndX, float fEndZ)
    {
    return pow(fStartX - fEndX, 2.0f) + pow(fStartZ - fEndZ, 2.0f);
    }
    
    bool CPet::isInRange(Unit * pTarget, float fSquaredRange)
    {
    return (GetDistance(pTarget) <= fSquaredRange);
    }
    
    float CPet::GetDistance(Unit * pTarget)
    {
    ASSERT(pTarget != nullptr);
    if (GetZoneID() != pTarget->GetZoneID())
    return -FLT_MAX;
    
    return GetDistance(pTarget->GetX(), pTarget->GetZ());
    }
    
    void CPet::AttackRequest(CNpc * pTarget)
    {
    CNpc * pNpc = g_pMain->GetNpcPtr(GetID());
    if (pTarget == nullptr || pNpc == nullptr )
    return;
    
    uint8 bResult = ATTACK_FAIL;
    short sDamage = GetHitDamage(TO_NPC(pTarget));
    sDamage += (20 * sDamage) / 100;
    if (sDamage > 0)
    {
    if (pTarget->isDead())
    return;
    else
    bResult = ATTACK_SUCCESS;
    
    pTarget->HpChange(-(sDamage), pNpc);
    SatisfactionChange(-15);
    }
    
    Packet result(WIZ_PET, uint8(1));
    result << uint8(PET_STATE_ATTACKING) << pTarget->GetID() << uint8(0) << pTarget->GetMaxHealth() << pTarget->GetHealth() << -sDamage;
    SendNpcRegion(&result);
    
    Packet result2(WIZ_ATTACK, uint8(LONG_ATTACK));
    result2 << bResult << GetID() << pTarget->GetID();
    SendNpcRegion(&result2);
    }
    
    short CPet::GetHitDamage(CNpc *pTarget)
    {
    if (pTarget == nullptr)
    return 0;
    
    short damage = 0, Hit = m_sTotalHit, Ac = pTarget->m_sTotalAc;
    uint8 result = GetHitRate(m_fTotalHitrate / pTarget->m_fTotalEvasionrate);
    switch (result)
    {
    case GREAT_SUCCESS:
    damage = (short)(0.6 * Hit);
    if (damage <= 0)
    {
    damage = 0;
    break;
    }
    damage = myrand(0, damage);
    damage += (short)(0.7 * Hit);
    break;
    
    case SUCCESS:
    case NORMAL:
    if (Hit - Ac > 0)
    {
    damage = (short)(0.6 * (Hit - Ac));
    if (damage <= 0)
    {
    damage = 0;
    break;
    }
    damage = myrand(0, damage);
    damage += (short)(0.7 * (Hit - Ac));
    }
    break;
    }
    
    // Enforce damage cap
    if (damage > MAX_DAMAGE)
    damage = MAX_DAMAGE;
    
    return damage;
    }
    
    void CPet::GetPetStatus()
    {
    
    
    }
    
    void CPet::GetInOut(Packet& result, uint8 bType)
    {
    
    }
    
    void CPet::AddToRegion(int16 new_region_x, int16 new_region_z)
    {
    
    }
    
    void CPet::OnAttack(Unit* pTarget, AttackType attackType)
    {
    
    }
    
    void CPet::OnDefend(Unit* pAttacker, AttackType attackType)
    {
    
    }
    
    void CPet::InsertSavedMagic(uint32 nSkillID, uint16 sDuration)
    {
    
    }
    
    void CPet::StateChangeServerDirect(uint8 bType, uint32 nBuff)
    {
    
    }
    
    [/hide]

    Pet.h dosyası :

    [hide]
    Kod:
    #pragma once
    
    #include "stdafx.h"
    #include "Unit.h"
    
    #define SATISF_MAX 10000
    #define SETISF_LEAF 1200
    #define SETISF_BREAD 4000
    #define SETISF_MILK 9000
    
    // Time (in seconds) between each save request (2 min).
    #define PET_SAVE_INTERVAL      (2 * 60)
    
    // Time (in seconds) between each save request (2 min).
    #define SATISF_DAMAGE_INTERVAL      (2 * 60)
    
    enum PetTypesOpcodes
    {
    PET_TYPE_OTHERS = 1,
    PET_TYPE_MAGIC = 2
    };
    
    enum PetOpcodes
    {
    PET_MAGIC_PROCESS = 0x03,
    PET_STATE_CHANGE = 0x05,
    PET_STATE_HPCHANGE = 0x07,
    PET_STATE_ATTACKING = 0x08,
    PET_STATE_EXP = 0x0A,
    PET_STATE_LEVELUP = 0x0B,
    PET_STATE_MP = 0x0D,
    PET_STATE_ITEM = 0x0E,
    PET_STATE_SATISF = 0x0F,
    PET_STATE_SATISF_GAIN = 0x10,
    PET_NAME_CHANGE = 0x11
    };
    
    enum PetStateOpcodes
    {
    PET_STATE_ATTACK = 3,
    PET_STATE_DEFENCE = 4,
    PET_STATE_AUTOLOOT = 8
    };
    
    enum PetFunctionOpcodes
    {
    PET_FUNC_NONE = 0,
    PET_FUNC_ATTACKING = 1
    };
    
    enum PetModeOpcodes
    {
    PET_MODE_ATTACK = 3,
    PET_MODE_DEFENSE = 4,
    PET_MODE_LOOTING = 8
    };
    
    class CGameServerDlg;
    class CPet : public Unit
    {
    public:
    CPet();
    
    std::string m_OwnerName;
    std::string m_PetName;
    uint32 m_Serial;
    uint32 m_ItemID;
    int16 m_sNid;
    int16 m_UserID;
    uint64 m_iExp;
    uint16 m_sSatisfaction;
    uint8 m_bClass;
    short m_sMaxHp, m_sHp, m_sMaxMp, m_sMp;
    uint16 m_sAttack, m_sAc;
    uint32  m_iSellingGroup;
    int16 m_byDirection;
    uint16 m_sSid;
    uint16 m_sPid;
    uint16 m_sSize;
    uint32 m_iWeapon_1;
    uint32 m_iWeapon_2;
    uint8 m_bNation;
    uint8 m_bZone;
    float m_curx, m_curz, m_cury;
    uint8 m_PetState;
    time_t m_plastSaveTime;
    time_t m_SatisfTime;
    uint32 LastMovedTime;
    bool m_isBusy;
    uint8 m_Mode;
    uint8 m_Function;
    int16 m_TargetID;
    time_t m_ThreadTime;
    bool m_byLevelUP;
    
    uint32 LastStep;
    _ITEM_DATA m_sItemArray[PET_ITEM_MAX];
    
    INLINE bool isBusy() { return m_isBusy; }
    INLINE float GetX() { return m_curx; }
    INLINE float GetY() { return m_cury; }
    INLINE float GetZ() { return m_curz; }
    
    INLINE uint16 GetSPosX() { return uint16(GetX() * 10); };
    INLINE uint16 GetSPosY() { return uint16(GetY() * 10); };
    INLINE uint16 GetSPosZ() { return uint16(GetZ() * 10); };
    
    INLINE _ITEM_DATA * GetItem(uint8 pos)
    {
    ASSERT(pos < PET_ITEM_MAX);
    return &m_sItemArray[pos];
    }
    
    // Packet Handlers
    void Send(Packet * pkt);
    void SendNpcRegion(Packet * pkt);
    void SendUserRegion(Packet * pkt);
    void HandleStateChange(Packet & pkt);
    void HandleSatisfaction(Packet & pkt);
    
    // Normal Voids
    void PetThread();
    void Update();
    void PetSaveDataRequest();
    void PetItemGet(_PET_BUNDLE * pBundle);
    void RuntoBundle();
    void CheckUserOnline();
    void OnDeath();
    bool CheckExistItem(uint32 itemid, uint16 count = 1);
    void SendMyInfo();
    bool isInRange(float fx, float fz, float fSquaredRange);
    bool isInRange(Unit * pTarget, float fSquaredRange);
    float GetDistance(float fx, float fz);
    float GetDistance(Unit * pTarget);
    static float GetDistance(float fStartX, float fStartZ, float fEndX, float fEndZ);
    void SetPetAbility();
    void AttackRequest(CNpc * pTarget);
    void SatisfactionChange(int16 amount, uint8 RecvSlot = 0, uint32 RecvItemID = 0, uint8 RecvType = 0, uint16 nCount = 0);
    void SummonPet(CUser * pSessionz, uint32 nItemNum);
    short GetHitDamage(CNpc *pTarget);
    void UpdatePetItem();
    void GetPetStatus();
    
    // Pet Threads
    time_t CheckAttack();
    time_t CheckLootPick();
    
    virtual void Initialize();
    virtual uint16 GetID() { return m_sNid; };
    virtual std::string & GetName() { return m_PetName; };
    virtual int16 GetUserID() { return m_UserID; }
    virtual int32 GetHealth() { return m_sHp; };
    virtual int32 GetMaxHealth() { return m_sMaxHp; };
    virtual int32 GetMana() { return m_sMp; };
    virtual int32 GetMaxMana() { return m_sMaxMp; };
    virtual bool isDead() { return m_sHp <= 0; };
    
    virtual void Moving(float toX, float toY, float toZ, uint8 Speed);
    void SendMoveResult(float fX, float fY, float fZ, float fSpeed /*= 0.0f*/);
    
    INLINE short GetProtoID() { return m_sSid; };
    
    void GetNpcInfos(Packet & pkt, CUser* pUser = nullptr);
    
    virtual bool isAlive() { return isAlive(); };
    virtual void GetInOut(Packet& result, uint8 bType);
    virtual void AddToRegion(int16 new_region_x, int16 new_region_z);
    virtual short GetDamage(Unit* pTarget, _MAGIC_TABLE* pSkill, bool bPreviewOnly) { return GetDamage(pTarget, pSkill, bPreviewOnly); };
    virtual void OnAttack(Unit* pTarget, AttackType attackType);
    virtual void OnDefend(Unit* pAttacker, AttackType attackType);
    virtual void InsertSavedMagic(uint32 nSkillID, uint16 sDuration);
    virtual bool HasSavedMagic(uint32 nSkillID) { return HasSavedMagic(nSkillID); };
    virtual int16 GetSavedMagicDuration(uint32 nSkillID) { return GetSavedMagicDuration(nSkillID); };
    virtual void HpChange(int amount, Unit* pAttacker, bool bSendToAI);
    virtual void HpChangeMagic(int amount, Unit* pAttacker, AttributeType attributeType);
    virtual void MSpChange(int amount);
    virtual void ExpChange(int64 amount);
    virtual void Dead();
    virtual void StateChangeServerDirect(uint8 bType, uint32 nBuff);
    virtual bool isHostileTo(Unit* pTarget) { return isHostileTo(pTarget); };
    virtual bool CanAttack(Unit* pTarget) { return CanAttack(pTarget); };
    virtual bool isAttackable(Unit* pTarget) { return isAttackable(pTarget); };
    virtual bool CanCastRHit(uint16 m_SocketID) { return CanCastRHit(m_SocketID); };
    
    };
    
    [/hide]

    Not : Umarım işinize Yarar
     
  2. Çevrim Dışı
    falancas

    falancas New Member

    • Mesajlar:  9
    • Beğenilen Mesajlarınız:0
    7 Temmuz 2018
    Pet için mi?
     
  3. Çevrim Dışı
    Staff Member
    tancan78

    tancan78 Moderator

    • Mesajlar:  59
    • Beğenilen Mesajlarınız:0
    16 Haziran 2018
    Cinsiyet:
    Bay
    Bulunduğu Yer
    Bursa
    evet arkadaşım
     
  4. Çevrim Dışı
    xnko

    xnko New Member

    • Mesajlar:  3
    • Beğenilen Mesajlarınız:0
    30 Haziran 2018
    teşekkürler
     
  5. Çevrim Dışı
    falancas

    falancas New Member

    • Mesajlar:  9
    • Beğenilen Mesajlarınız:0
    7 Temmuz 2018
    İşe yaramadı bende.
     
  6. Çevrim Dışı
    Staff Member
    DaTaTr

    DaTaTr Administrator

    • Mesajlar:  95
    • Beğenilen Mesajlarınız:0
    12 Haziran 2018
    Cvp: RE: YENİ PET.CPP ve PAKETLERİ

    hatamı aldınız yoksa başka bir sorun mu var paylaşırsanız yardımcı olabilirim lütfen yardım konusuna açalım.
     
  7. Çevrim Dışı
    falancas

    falancas New Member

    • Mesajlar:  9
    • Beğenilen Mesajlarınız:0
    7 Temmuz 2018
    Pet görevi alınmıyor. Siz deneyip mi paylaştınız, tam olarak hangi files'da?
     
  8. Çevrim Dışı
    Staff Member
    DaTaTr

    DaTaTr Administrator

    • Mesajlar:  95
    • Beğenilen Mesajlarınız:0
    12 Haziran 2018
    Cvp: YENİ PET.CPP ve PAKETLERİ

    ben denemedim de mod arkadaşımız deneyip paylaştı

    Bu Fileslerda
     

Sayfayı Paylaş

- Henüz üye değil misiniz?  Şimdi üye olun!