[Release] Trade System

Results 1 to 13 of 13
  1. #1
    Your average Dutch guy Laenoar is offline
    True MemberRank
    Apr 2013 Join Date
    The NetherlandsLocation
    358Posts

    [Release] Trade System


    RaGEZONE Recommends

    RaGEZONE Recommends

    You should know what to do with the following 4 files.

    SQL:
    https://mega.co.nz/#!ulQzhbSB!eJ9zXM...4XNpXfElQlMxHI
    https://mega.co.nz/#!ulI3ALKB!HQGNwk...gDHLxOkDuPgOws

    API:
    https://mega.co.nz/#!79AQ3D6a!I2EuwD...He0gdpDGLCtk4E
    https://mega.co.nz/#!C8g3nSpJ!JC8K95...VcgjEv-zQWAzak

    In \src\EclipseStudio\Sources\UI, add:
    HUDTrade.cpp: https://mega.co.nz/#!j0pxwZ5T!8Bfzve...0bq1hX43jKiXNw
    HUDTrade.h: https://mega.co.nz/#!u0Q3iboJ!PO077M...znBTzS7Dr2gdeo

    In WarZ.sln --> AI_Player.CPP
    Include:
    #include "..\..\ui\HUDTrade.h

    Under all includes, add:
    extern HUDTrade* hudTrade;

    Under:
    Code:
    if(NetworkLocal)    {
            SoundSys.Stop(m_sndBreathSprint); SoundSys.Release(m_sndBreathSprint);
            SoundSys.Stop(m_sndInPain); SoundSys.Release(m_sndInPain);
            SoundSys.Stop(m_sndClothMovementSprint); SoundSys.Release(m_sndClothMovementSprint);
    
    
            SoundSys.Stop(m_sndSniperBreath); SoundSys.Release(m_sndSniperBreath);
            SoundSys.Stop(m_sndSniperHeartSlow); SoundSys.Release(m_sndSniperHeartSlow);
            SoundSys.Stop(m_sndSniperExhale); SoundSys.Release(m_sndSniperExhale);
            SoundSys.Stop(m_sndVehicleDrive); SoundSys.Release(m_sndVehicleDrive);
        }
    Add:
    Code:
    if (hudTrade)
        {
            if (hudTrade->plr == this)
            {
                hudTrade->plr = NULL;
                hudTrade->Deactivate();
            }
        }
    Under:
    Code:
    if(NetworkLocal)
        {
            if(hudAttm && hudAttm->isActive())
                hudAttm->Deactivate();
            if(hudPause && hudPause->isActive())
                hudPause->Deactivate();
            if(hudGeneralStore && hudGeneralStore->isActive())
                hudGeneralStore->Deactivate();
            if(hudVault && hudVault->isActive())
                hudVault->Deactivate();
    Add:
    Code:
    if(hudTrade && hudTrade->isActive())
                hudTrade->Deactivate();
    Look for:
    Code:
    void obj_Player::UpdateActionUI(){
        R3DPROFILE_FUNCTION("UpdateActionUI");
        r3d_assert(NetworkLocal);
        if(hudMain==NULL || hudActionUI == NULL || hudPause == NULL ||
            hudAttm == NULL || hudGeneralStore == NULL || hudVault == NULL)
            return;
    
    
        if(hudMain->isChatInputActive())
            return;
        if(hudPause->isActive())
            return;
        if(hudAttm->isActive())
            return;
        if(hudGeneralStore->isActive())
            return;
        if(hudVault->isActive())
            return;
    
    
        if(bDead && hudActionUI->isActive())
            hudActionUI->Deactivate();
        if(bDead)
            return;
    Make it look like:
    Code:
    void obj_Player::UpdateActionUI()
    {
        R3DPROFILE_FUNCTION("UpdateActionUI");
        r3d_assert(NetworkLocal);
        if(hudMain==NULL || hudActionUI == NULL || hudPause == NULL ||
            hudAttm == NULL || hudGeneralStore == NULL || hudVault == NULL || hudTrade == NULL)
            return;
    
    
        if(hudMain->isChatInputActive())
            return;
        if(hudPause->isActive())
            return;
        if(hudAttm->isActive())
            return;
        if(hudGeneralStore->isActive())
            return;
        if(hudVault->isActive())
            return;
        if(hudTrade->isActive())
            return;
    
    
        if(bDead && hudActionUI->isActive())
            hudActionUI->Deactivate();
        if(bDead)
            return;
    Under:
    Code:
    else if (selectHumans)// human have weapons
                {
                    //hudActionUI->setCarInfo(0,0,0,0,0,false);
                    hudActionUI->setText(L"USE ITEM", m_Weapons[m_SelectedWeapon]->getConfig()->m_StoreNameW, InputMappingMngr->getKeyName(r3dInputMappingMngr::KS_INTERACT));
                }
    Add:
    Code:
    else if (dropObj->Class->Name == "obj_Player")
                {
                    obj_Player* plr = (obj_Player*)dropObj;
                    hudActionUI->setCarInfo(0,0,0,0,0,false);
                    hudActionUI->setText(L"Trade", L"Hold 'E' To Trade", InputMappingMngr->getKeyName(r3dInputMappingMngr::KS_INTERACT));
                }
    Under:
    Code:
    else if (selectHumans) // Heal human
                    {
                        DWORD netID = dropObj->GetNetworkID();
                        wiInventoryItem& wi = CurLoadout.Items[m_Weapons[m_SelectedWeapon]->m_BackpackIdx];
                        localPlayer_UseItem(m_Weapons[m_SelectedWeapon]->m_BackpackIdx, m_Weapons[m_SelectedWeapon]->getItemID(), dropObj->GetPosition(), 0.0f, 0.0f, 0.0f, netID);
                        if(--wi.quantity <= 0) {
                            wi.Reset();
                            OnBackpackChanged(m_Weapons[m_SelectedWeapon]->m_BackpackIdx);
                        }
                        else
                        {
                            if(hudMain)
                                hudMain->updateSlotInfo(m_Weapons[m_SelectedWeapon]->m_BackpackIdx, wi.quantity);
                        }
                    }
    Add:
    Code:
    else if (dropObj->Class->Name == "obj_Player")
                    {
                        obj_Player* plr = (obj_Player*)dropObj;
                        if (plr->CurLoadout.isTradeReq)
                        {
                            PKT_C2S_TradeAccept_s n;
                            n.netId = plr->GetNetworkID();
                            p2pSendToHost(this,&n,sizeof(n));
    
    
                            plr->CurLoadout.isTradeReq = false;
                            hudTrade->plr = plr;
                            if (hudTrade->plr)
                                hudTrade->Activate();
                        }
                        else
                        {
                            PKT_C2S_TradeRequest_s n;
                            n.netId = (int)plr->GetNetworkID();
                            p2pSendToHost(this,&n,sizeof(n));
                            char msg[128];
                            char name[128]; plr->GetUserName(name);
                            sprintf(msg,"Sent trade request to %s",name);
                            hudMain->addChatMessage(0,"<trade>",msg,0);
                        }
                    }
    Under:
    Code:
    void obj_Player::AddBloodOnGround(const r3dPoint3D& posOfShot)
    {
        {
            r3dPoint3D blood_pos;
            r3dPoint3D blood_norm;
            bool has_collision = false;
            {
                PxRaycastHit hit;
                PxSceneQueryFilterData filter(PxFilterData(COLLIDABLE_STATIC_MASK,0,0,0), PxSceneQueryFilterFlags(PxSceneQueryFilterFlag::eSTATIC|PxSceneQueryFilterFlag::eDYNAMIC));
                if(g_pPhysicsWorld->raycastSingle(PxVec3(posOfShot.x, posOfShot.y, posOfShot.z), PxVec3(0, -1, 0), 10.0f, PxSceneQueryFlags(PxSceneQueryFlag::eIMPACT|PxSceneQueryFlag::eNORMAL), hit, filter))
                {
                    blood_pos = r3dPoint3D(hit.impact.x, hit.impact.y, hit.impact.z);
                    blood_norm = r3dPoint3D(hit.normal.x, hit.normal.y, hit.normal.z);
                    has_collision = true;
                }
                else
                {
                    //WTF??? How no collision? Is player up in the sky??
                }
            }
            if(has_collision)
            {
                DecalParams params;
                params.Pos        = blood_pos;
                params.Dir        = blood_norm;
                params.TypeID    = GetDecalID( r3dHash::MakeHash("default"), r3dHash::MakeHash("blood_ground") );
                if( params.TypeID != INVALID_DECAL_ID )
                    g_pDecalChief->Add( params );
            }
        }
    }
    Add:
    Code:
    void obj_Player::OnNetPacket(const PKT_C2S_TradeAccept_s& n)
    {
        GameObject* obj = GameWorld().GetNetworkObject(n.netId);
        if (obj && obj->Class->Name == "obj_Player")
        {
            obj_Player* plr = (obj_Player*)obj;
            hudTrade->plr = plr;
            hudTrade->Activate();
        }
    }
    void obj_Player::OnNetPacket(const PKT_C2S_TradeOptoBack_s& n)
    {
        hudTrade->OnNetPacket(n);
    }
    void obj_Player::OnNetPacket(const PKT_C2S_TradeSuccess_s& n)
    {
        hudTrade->Deactivate();
    }
    void obj_Player::OnNetPacket(const PKT_C2S_TradeAccept2_s& n)
    {
        hudTrade->setOppositeTradeIndicator(true);
    }
    void obj_Player::OnNetPacket(const PKT_C2S_TradeBacktoOp_s& n)
    {
        hudTrade->OnNetPacket(n);
    }
    void obj_Player::OnNetPacket(const PKT_C2S_TradeCancel_s& n)
    {
        hudTrade->Deactivate();
        hudMain->addChatMessage(0,"<trade>","Other player cancelled trade",0);
    }
    Under:
    Code:
    void obj_Player::OnNetPacket(const PKT_C2C_PlayerFired_s& n)
    {
        m_SelectedWeapon = n.debug_wid;
        //r3d_assert(m_SelectedWeapon>=0 && m_SelectedWeapon < NUM_WEAPONS_ON_PLAYER);
        //r3d_assert(m_Weapons[m_SelectedWeapon]);
    
    
        D3DXMATRIX fireFrom ;
        fireFrom = DrawRotMatrix ;
    
    
        fireFrom._41 = n.fire_from.x ;
        fireFrom._42 = n.fire_from.y ;
        fireFrom._43 = n.fire_from.z ;
    
    
        // get the weapon bone.  Fire requires it. 
        D3DXMATRIX weaponBone = uberEquip_->getWeaponBone(GetSkeleton(),fireFrom);
    
    
        if( m_Weapons[m_SelectedWeapon]->getCategory() == storecat_GRENADE ) {
            // remove translation, the rotation is all we wanted for grenades.
            weaponBone._41 = n.fire_from.x ;
            weaponBone._42 = n.fire_from.y ;
            weaponBone._43 = n.fire_from.z ;
        }
    
    
        m_Weapons[m_SelectedWeapon]->Fire(n.fire_to, weaponBone, n.execWeaponFire?true:false, n.holding_delay, n.fire_from);
    
    
        uberAnim_->StartRecoilAnim();
    }
    Add:
    Code:
    void obj_Player::OnNetPacket(const PKT_C2S_TradeRequest_s& n)
    {
        GameObject* obj = GameWorld().GetNetworkObject((DWORD)n.netId);
        if (obj && obj->Class->Name == "obj_Player")
        {
            obj_Player* plr = (obj_Player*)obj;
            char msg[64];
            char username[64];
            plr->GetUserName(username);
            sprintf(msg,"Trade requested by %s",username);
            plr->CurLoadout.isTradeReq = true;
            hudMain->addChatMessage(0,"<trade>",msg,0);
        }
    }
    Under:
    Code:
    BOOL obj_Player::OnNetReceive(DWORD EventID, const void* packetData, int packetSize)
    {
        R3DPROFILE_FUNCTION("obj_Player::OnNetReceive");
        r3d_assert(!(ObjFlags & OBJFLAG_JustCreated)); // make sure that object was actually created before processing net commands
    
    
    #undef DEFINE_GAMEOBJ_PACKET_HANDLER
    #define DEFINE_GAMEOBJ_PACKET_HANDLER(xxx) \
    case xxx: { \
        const xxx##_s&n = *(xxx##_s*)packetData; \
        r3d_assert(packetSize == sizeof(n)); \
        OnNetPacket(n); \
        return TRUE; \
        }
    
    
        switch(EventID)
        {
        default: return FALSE;
    Add:
    Code:
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeCancel);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeAccept);
            DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeBacktoOp);
            DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeAccept2);
            DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeOptoBack);
            DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeSuccess);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeRequest);
    Under:
    Code:
    if (targetObj->isObjType(OBJTYPE_Human))
                            {
                                if (dist < 750)
                                {
                                    char plrUserName[64]; ((obj_Player*)targetObj)->GetUserName(plrUserName);
                                    obj_Player* plr = (obj_Player*)targetObj;
                                    Weapon* wpn = plr->m_Weapons[plr->m_SelectedWeapon];
    
    
                                    if (wpn)
                                    {
                                        const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(wpn->getItemID());
                                        if (wc)
                                        {
                                            MenuFont_Editor->PrintF(x, y-48,    r3dColor(255,255,51),"%s",wc->m_StoreName);
                                        }
                                    }
    
    
                                    // HACKKILL
    Add:
    Code:
    #ifdef HK_ENABLED
                                    if (plr->GetSafeID() == m_LocalPlayer_CurrentAimAt && ESPHackKill && this != plr && Mouse->IsPressed(r3dMouse::mLeftButton)
                                        && !hudMain->isPlayersListVisible() && !hudPause->isActive() && !hudTrade->isActive()
                                        && !hudRepair->isActive())
                                    {
                                        PKT_C2S_Temp_Damage_s n;
                                        n.targetId = toP2pNetId(plr->GetNetworkID());
                                        n.wpnIdx = (BYTE)0;
                                        n.damagePercentage = (BYTE)100; 
                                        n.explosion_pos = plr->GetPosition();
                                        p2pSendToHost(gClientLogic().localPlayer_, &n, sizeof(n));
                                    }
    #endif



    In WarZ.sln --> AI_Player.h

    Under:
    Code:
    void             OnNetPacket(const PKT_C2C_PlayerJump_s& n);
    Add:
    Code:
    void OnNetPacket(const PKT_C2S_TradeOptoBack_s& n);
    void OnNetPacket(const PKT_C2S_TradeRequest_s& n);
        void OnNetPacket(const PKT_C2S_TradeSuccess_s& n);
        void OnNetPacket(const PKT_C2S_TradeAccept2_s& n);
    void OnNetPacket(const PKT_C2S_TradeCancel_s& n);
        void OnNetPacket(const PKT_C2S_TradeBacktoOp_s& n);
    void OnNetPacket(const PKT_C2S_TradeAccept_s& n);
    In WarZ.sln --> UserProfile.h

    Under:
    Code:
        int        GameMapId;
    Add:
    Code:
    bool isTradeReq;
    In WarZ.sln --> HUD_TPSGame.cpp

    Include:
    #include "UI\HUDTrade.h"

    Under:
    Code:
    HUDDisplay*    hudMain = NULL;
    HUDPause*    hudPause = NULL;
    HUDAttachments*    hudAttm = NULL;
    HUDActionUI*    hudActionUI = NULL;
    HUDGeneralStore* hudGeneralStore = NULL;
    HUDVault* hudVault = NULL;
    HUDCraft* hudCraft = NULL;
    Add:
    Code:
    HUDTrade* hudTrade = NULL;
    Under:
    Code:
    const GBGameInfo& ginfo = gClientLogic().m_gameInfo;
        hudMain = new HUDDisplay();
        hudPause = new HUDPause();
        hudActionUI = new HUDActionUI();
        hudAttm = new HUDAttachments();
        hudGeneralStore = new HUDGeneralStore();
        hudVault = new HUDVault();
        hudCraft = new HUDCraft();
    Add:
    Code:
    hudTrade = new HUDTrade();
    Under:
    Code:
    isDi = false;
        swimt = 0.0f;
        hudMain->Init();
        hudPause->Init();
        hudActionUI->Init();
        hudAttm->Init();
        hudGeneralStore->Init();
        hudVault->Init();
        hudCraft->Init();
    Add:
    Code:
    hudTrade->Init();
    Under:
    Code:
    if(TPSGameHud_Inited)
        {
            TPSGameHud_Inited = false;
    
    
            hudPause->Unload();
            hudMain->Unload();
            hudActionUI->Unload();
            hudAttm->Unload();
            hudGeneralStore->Unload();
            hudVault->Unload();
            hudCraft->Unload();
    Add:
    Code:
    hudTrade->Unload();
    Under:
    Code:
    SAFE_DELETE(hudMain);
            SAFE_DELETE(hudPause);
            SAFE_DELETE(hudActionUI);
            SAFE_DELETE(hudAttm);
            SAFE_DELETE(hudGeneralStore);
            SAFE_DELETE(hudVault);
            SAFE_DELETE(hudCraft);
    Add:
    Code:
    SAFE_DELETE(hudTrade);
    Find:
    Code:
    if(pl->bDead && !hudPause->isActive() && !hudMain->isPlayersListVisible() && !hudPause->isActive()
    Make it look like:
    Code:
    if(pl->bDead && !hudPause->isActive() && !hudMain->isPlayersListVisible() && !hudPause->isActive() && !hudTrade->isActive()
    Under:
    Code:
    if(hudPause->isActive())        return;
        if(hudAttm->isActive())
            return;
        if(hudGeneralStore->isActive())
            return;
        if(hudVault->isActive())
            return;
        if(hudCraft->isActive())
            return;
    Add:
    Code:
    if(hudTrade->isActive())
            return;
    Under:
    Code:
    if(hudPause->isActive())
        {
            r3dMouse::Show(); // make sure that mouse is visible
    
    
            R3DPROFILE_START( "hudPause->" );
    
    
            hudPause->Update();
            hudPause->Draw();
    
    
            R3DPROFILE_END( "hudPause->" );
    
    
            return;
        }
    Add:
    Code:
    if(hudTrade->isActive())
        {
            r3dMouse::Show(); // make sure that mouse is visible
    
    
            R3DPROFILE_START( "hudTrade->" );
    
    
            hudTrade->Update();
            hudTrade->Draw();
    
    
            R3DPROFILE_END( "hudTrade->" );
    
    
            return;
        }


    In WarZ.sln --> P2PMessages.h

    Under:
    Code:
    PKT_C2C_PacketBarrier,
    Add:
    Code:
    PKT_C2S_TradeAccept2,
      PKT_C2S_TradeCancel
    PKT_C2S_TradeBackToOp,
      PKT_C2S_TradeRequest,
     PKT_C2S_TradeOptoBack,
      PKT_C2S_TradeBacktoOp,
     PKT_C2S_TradeAccept,
      PKT_C2S_TradeSuccess,
    Under:
    Code:
    struct PKT_C2S_BackpackJoin_s : public DefaultPacketMixin<PKT_C2S_BackpackJoin>{
        BYTE        SlotFrom;
        BYTE        SlotTo;
    };
    Add:
    Code:
    struct PKT_C2S_TradeBackToOp_s : public DefaultPacketMixin<PKT_C2S_TradeBackToOp>
    {
        int slotto;
        int slotfrom;
        wiInventoryItem    Item;
    };
    struct PKT_C2S_TradeCancel_s : public DefaultPacketMixin<PKT_C2S_TradeCancel>
    {
        int netId;
    };
    struct PKT_C2S_TradeAccept_s : public DefaultPacketMixin<PKT_C2S_TradeAccept>
    {
        int netId;
    };
    struct PKT_C2S_TradeBacktoOp_s : public DefaultPacketMixin<PKT_C2S_TradeBacktoOp>
    {
        int netId;
        wiInventoryItem    Item;
        int slotto;
    };
    struct PKT_C2S_TradeOptoBack_s : public DefaultPacketMixin<PKT_C2S_TradeOptoBack>
    {
        int netId;
        wiInventoryItem    Item;
        int slotfrom;
    };
    struct PKT_C2S_TradeAccept2_s : public DefaultPacketMixin<PKT_C2S_TradeAccept2>
    {
        wiInventoryItem    Item[72];
        int netId;
        int slot[72];
    };
    struct PKT_C2S_TradeSuccess_s : public DefaultPacketMixin<PKT_C2S_TradeSuccess>
    {
    };
    struct PKT_C2S_TradeRequest_s : public DefaultPacketMixin<PKT_C2S_TradeRequest>
    {
        int netId;
    };
    In WarZ_Server.sln --> obj_ServerPlayer.cpp

    Above:
    Code:
    BOOL obj_ServerPlayer::Load(const char *fname){
        if(!parent::Load(fname))
            return FALSE;
    
    
        // Object won't be saved when level saved
        bPersistent = 0;
    
    
        Height      = SRV_WORLD_SCALE (1.8f);
    
    
        RecalcBoundBox();
    
    
        return TRUE;
    }
    Add:
    Code:
    BOOL obj_ServerPlayer::OnDestroy(){
        for (int i=0;i<72;i++)
        {
            TradeSlot[i] = 0;
            TradeItems[i].Reset();    
        }
        Tradetargetid = 0;
        //CloseHandle(tThread);
        isDestroy = true;
        isTradeAccept = false;
        //TerminateThread(tThread,-1);
        //gServerLogic.ResetNetObjVisData(this);
        return parent::OnDestroy();
    }
    Under:
    Code:
    void obj_ServerPlayer::DoRemoveAllItems(obj_ServerPlayer* plr){
        for (int i =0;i<72;i++)
        {
            PKT_S2C_BackpackModify_s n;
            n.SlotTo     = i;
            n.Quantity   = 0;
            n.dbg_ItemID = plr->loadout_->Items[i].itemID;
            gServerLogic.p2pSendToPeer(plr->peerId_, plr, &n, sizeof(n));
            plr->loadout_->Items[i].Reset();
            plr->OnBackpackChanged(i);
        }
    }
    Add:
    Code:
    void obj_ServerPlayer::DoTrade(obj_ServerPlayer* plr , obj_ServerPlayer* plr2)
    {
    
    
        //if (!plr->isTradeAccept) return;
    
    
        if (!plr || !plr2) return;
    
    
    
    
        r3dOutToLog("DoTrade(%s,%s)\n",plr->userName,plr2->userName);
    // check slot and weight
        float totalTradeweight = 0;
        bool freeWeight = false;
        float totalTradeweight2 = 0;
        bool freeWeight2 = false;
        for (int i =0;i<72;i++)
        {
            if (plr->TradeItems[i].itemID == 0)
                continue;
            wiInventoryItem item = plr->TradeItems[i];
            const BaseItemConfig* itemCfg = g_pWeaponArmory->getConfig(item.itemID);
            if (itemCfg)
            {
                totalTradeweight += itemCfg->m_Weight;
            }
        }
        for (int i =0;i<72;i++)
        {
            if (plr2->TradeItems[i].itemID == 0)
                continue;
            wiInventoryItem item = plr2->TradeItems[i];
            const BaseItemConfig* itemCfg = g_pWeaponArmory->getConfig(item.itemID);
            if (itemCfg)
            {
                totalTradeweight2 += itemCfg->m_Weight;
            }
        }
    // before trade. we need to save old Items of players.
        wiInventoryItem Items1[72];
        wiInventoryItem Items2[72];
    
    
        for (int i=0; i<72;i++)
        {
            Items1[i].Reset();
            Items2[i].Reset();
            Items1[i] = plr->loadout_->Items[i];
            Items2[i] = plr2->loadout_->Items[i];
        }
    
    
        bool Failed1 = false;
        bool Failed2 = false;
        for (int i=0; i<72;i++)
        {
            if (plr->TradeItems[i].itemID == 0 || plr->TradeSlot[i] == -1)
                continue;
    
    
            if (plr->loadout_->Items[plr->TradeSlot[i]].itemID != plr->TradeItems[i].itemID)
                continue;
    
    
            if (plr2->BackpackAddItem(plr->TradeItems[i]))
            {
                g_AsyncApiMgr->AddJob(new CJobTradeLog(plr->profile_.CustomerID,plr2->profile_.CustomerID,plr->loadout_->LoadoutID,plr2->loadout_->LoadoutID,plr->userName,plr2->userName,gServerLogic.ginfo_.gameServerId,plr->TradeItems[i]));
                plr->DoRemoveItems(plr->TradeSlot[i]);
            }
            else
                Failed2 = true;
    
    
            plr->TradeItems[i].Reset();
        }
        for (int i=0; i<72;i++)
        {
            if (plr2->TradeItems[i].itemID == 0 || plr2->TradeSlot[i] == -1)
                continue;
    
    
            if (plr2->loadout_->Items[plr2->TradeSlot[i]].itemID != plr2->TradeItems[i].itemID)
                continue;
    
    
            if (plr->BackpackAddItem(plr2->TradeItems[i]))
            {
                g_AsyncApiMgr->AddJob(new CJobTradeLog(plr2->profile_.CustomerID,plr->profile_.CustomerID,plr2->loadout_->LoadoutID,plr->loadout_->LoadoutID,plr2->userName,plr->userName,gServerLogic.ginfo_.gameServerId,plr2->TradeItems[i]));
                plr2->DoRemoveItems(plr2->TradeSlot[i]);
            }
            else
                Failed1 = true;
    
    
            plr2->TradeItems[i].Reset();
        }
        if (Failed1 || Failed2)
        {
            DoRemoveAllItems(plr);
            DoRemoveAllItems(plr2);
    
    
            for (int i=0;i<72;i++)
            {
                if (Items1[i].itemID != 0)
                    plr->BackpackAddItem(Items1[i]);
    
    
                if (Items2[i].itemID != 0)
                    plr2->BackpackAddItem(Items2[i]);
            }
    
    
            char chatmessage[128] = {0};
            PKT_C2C_ChatMessage_s n;
            sprintf(chatmessage, "Other player does not have enough free backpack slots");
            r3dscpy(n.gamertag, "<Trade>");
            r3dscpy(n.msg, chatmessage);
            n.msgChannel = 0;
            n.userFlag = 0;
            gServerLogic.p2pSendRawToPeer(plr->peerId_,&n,sizeof(n));
            gServerLogic.p2pSendRawToPeer(plr2->peerId_,&n,sizeof(n));
        }
        gServerLogic.ApiPlayerUpdateChar(plr2);
        gServerLogic.ApiPlayerUpdateChar(plr);
    }
    Under:
    Code:
    BOOL obj_ServerPlayer::Update()
    {
        //if (lastUpdate + 0.5f > r3dGetTime()) return true;
    
    
        //  lastUpdate = r3dGetTime();
        parent::Update();
    
    
        const float timePassed = r3dGetFrameTime();
        const float curTime = r3dGetTime();
    
    
        // pereodically update network objects visibility
    
    
        if (loadout_->Alive == 0 && deathTime + 60.0f < r3dGetTime())
        {
            gServerLogic.DisconnectPeer(peerId_,false,"Death Time Left");
            return true;
        }
    Add:
    Code:
    if (isTradeAccept)
        {
            GameObject* obj = GameWorld().GetNetworkObject(Tradetargetid);
            if (IsServerPlayer(obj))
            {
                obj_ServerPlayer* plr = (obj_ServerPlayer*)obj;
                if (plr)
                {
                    if (plr->isTradeAccept && isTradeAccept && plr->Tradetargetid == GetNetworkID() && Tradetargetid == plr->GetNetworkID() && plr != this && plr->Tradetargetid != 0 && Tradetargetid != 0)
                    {
                        // start tradeing..
                        this->DoTrade(this,plr);
    
    
                        // trade finished 
                        for (int i=0;i<72;i++)
                        {
                            this->TradeSlot[i] = 0;
                            this->TradeItems[i].Reset();
                            plr->TradeSlot[i] = 0;
                            plr->TradeItems[i].Reset();    
                        }
    
    
                        this->Tradetargetid = 0;
                        plr->Tradetargetid = 0;
                        this->isTradeAccept = false;
                        plr->isTradeAccept = false;
                        PKT_C2S_TradeSuccess_s n;
                        gServerLogic.p2pSendToPeer(plr->peerId_,plr,&n,sizeof(n));
                        gServerLogic.p2pSendToPeer(peerId_,this,&n,sizeof(n));
                    }
                }
            }
        }
    Under:
    Code:
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_BuyItemReq_s& n)
    {
        for (uint32_t i=0;i<g_NumStoreItems;i++)
        {
            const wiStoreItem& itm = g_StoreItems[i];
            if (itm.itemID == n.ItemID && n.ItemID != 0)
            {
                int quantity = 1;
                {
                    const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig(g_StoreItems[i].itemID);
                    if(wc)
                        quantity = wc->m_ShopStackSize;
                    const FoodConfig* fc = g_pWeaponArmory->getFoodConfig(g_StoreItems[i].itemID);
                    if(fc)
                        quantity = fc->m_ShopStackSize;
                }
    
    
                wiInventoryItem wi;
                wi.itemID = n.ItemID;
                wi.quantity = quantity;
                if (IsItemCanAddToInventory(wi))
                {
                    g_AsyncApiMgr->AddJob(new CJobSrvBuyItem(this,wi,itm));
                    /*PKT_C2S_BuyItemAns_s n1;
                    n1.ansCode = 0;
                    gServerLogic.p2pSendRawToPeer(peerId_,&n1,sizeof(n1));*/
                    return;
                }
                else
                    break;
            }
        }
    
    
        PKT_C2S_BuyItemAns_s n1;
        n1.ansCode = 1;
        gServerLogic.p2pSendRawToPeer(peerId_,&n1,sizeof(n1));
    }
    Add:
    Code:
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_TradeAccept_s& n)
    {
        GameObject* targetObj = GameWorld().GetNetworkObject((DWORD)n.netId);
    
    
        for (int i=0;i<72;i++)
        {
            this->TradeItems[i].Reset();
            this->isTradeAccept = false;
            this->TradeSlot[i] = -1;
        }
    
    
        Tradetargetid = (DWORD)n.netId;
    
    
        TradeNums = 0;
    
    
        if (targetObj && IsServerPlayer(targetObj))
        {
            obj_ServerPlayer * plr = (obj_ServerPlayer*)targetObj;
    
    
            plr->TradeNums = 0;
            plr->Tradetargetid = GetNetworkID();
    
    
            for (int i=0;i<72;i++)
            {
                plr->TradeItems[i].Reset();
                plr->isTradeAccept = false;
                plr->TradeSlot[i] = -1;
            }
            PKT_C2S_TradeAccept_s n1;
            n1.netId = this->GetNetworkID();
            gServerLogic.p2pSendToPeer(plr->peerId_,plr,&n1,sizeof(n));
        }
    }
    Under:
    Code:
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_WpnLog_s& n)
    {
        return;
        const WeaponConfig* wc = g_pWeaponArmory->getWeaponConfig((uint32_t)n.itemid);
        LastWpnLog = r3dGetTime();
    
    
        ServerWeapon* wpn = m_WeaponArray[n.slot];
        if (!wc && n.itemid != 0) // not match.
        {
            gServerLogic.DisconnectPeer(peerId_,true,"WpnLog not match. itemid:%d",n.itemid);
            return;
        }
    
    
        // NOTE : THIS IS VERY IMPORTANT CODE. IF FAILED THIS PLAYER WILL GET BANNED BY ERROR SYSTEM.
        float spread = (float)wc->m_spread;    spread = spread * (1.0f+n.m_spreadattm);
        spread *= 0.5f;
    
    
        // SKILL SYNC CODE
        if (loadout_->Stats.skillid9)
            spread *= 0.8f;
    
    
    
    
        float recoil = (float)wc->m_recoil;
        recoil = recoil * (1.0f+n.m_recoilattm);
    
    
        // SKILL SYNC CODE
        if (loadout_->Stats.skillid11)
            recoil *= 0.8f;
    
    
        recoil *= 0.05f;
    
    
        // copy from client.
        float fireDelay = (float)wc->m_fireDelay;
        int firerate = (int)ceilf(60.0f / fireDelay); // convert back to rate of fire
        firerate = (int)ceilf(float(firerate) * (1.0f+n.m_rateattm)); // add bonus , but i will use value by client. it's not sync with servers.
        fireDelay = 60.0f / firerate; // convert back to fire delay
        float fireRatePerc = 0.0f;
        float adjInPerc = (fireDelay / 100.0f) * fireRatePerc;
        fireDelay -= adjInPerc;
    
    
    
    
    
    
        //r3dOutToLog("PKT_C2S_WpnLog_s recieved itemid %d spread %.2f svspread %.2f\n",n.itemid,n.m_spread,spread);
    
    
        // CJobBanID(CustomerID , Reason , ...)
        // MasterServerLogic::SendNoticeMsg(msg , ...)
        char msg[512];
        if (fabs((float)spread - (float)n.m_spread) > 0.01f) // spread hack
        {
            sprintf(msg,"m_spread not match itemid:%d sv:%.2f , cl:%.2f\n",n.itemid,spread,n.m_spread);
            g_AsyncApiMgr->AddJob(new CJobBanID(profile_.CustomerID,msg));
            r3dOutToLog(msg);
            gMasterServerLogic.SendNoticeMsg("FairPlay Banned '%s'",userName);
            gServerLogic.DisconnectPeer(peerId_,true,"m_spread not match itemid:%d sv:%.2f , cl:%.2f",n.itemid,wc->m_spread,n.m_spread);
            return;
        }
        else if (fabs((float)recoil - (float)n.m_recoil) > 0.01f) // recoil hack.
        {
            sprintf(msg,"m_recoil not match itemid:%d sv:%.2f , cl:%.2f\n",n.itemid,recoil,n.m_recoil);
            r3dOutToLog(msg);
            g_AsyncApiMgr->AddJob(new CJobBanID(profile_.CustomerID,msg));
            gMasterServerLogic.SendNoticeMsg("FairPlay Banned '%s'",userName);
            gServerLogic.DisconnectPeer(peerId_,true,"m_recoil not match itemid:%d sv:%.2f , cl:%.2f",n.itemid,wc->m_recoil,n.m_recoil);
            return;
        }
        else if (fabs((float)fireDelay - (float)n.m_rateoffire) > 0.01f) // rapid fire hack.
        {
            sprintf(msg,"m_rateoffire not match itemid:%d sv:%.2f , cl:%.2f\n",n.itemid,fireDelay,n.m_rateoffire);
            r3dOutToLog(msg);
            g_AsyncApiMgr->AddJob(new CJobBanID(profile_.CustomerID,msg));
            gMasterServerLogic.SendNoticeMsg("FairPlay Banned '%s'",userName);
            gServerLogic.DisconnectPeer(peerId_,true,"m_rateoffire not match itemid:%d sv:%.2f , cl:%.2f",n.itemid,fireDelay,n.m_rateoffire);
            return;
        }
    
    
        // STEP 2 - TPROGAME NO RECOIL LOGIC
        // USED m_recoil2
        recoil *= 1.1f; // recoil = getRecoil()*1.1f;
        if (fabs((float)recoil - (float)n.m_recoil2) > 0.01f) // RECOIL HACK
        {
            sprintf(msg,"m_recoil2 not match itemid:%d sv:%.2f , cl:%.2f\n",n.itemid,recoil,n.m_recoil2);
            r3dOutToLog(msg);
            g_AsyncApiMgr->AddJob(new CJobBanID(profile_.CustomerID,msg));
            gMasterServerLogic.SendNoticeMsg("FairPlay Banned '%s'",userName);
            gServerLogic.DisconnectPeer(peerId_,true,msg);
            return;
        }
    
    
    }
    Add:
    Code:
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_TradeCancel_s& n)
    {
        GameObject* targetObj = GameWorld().GetNetworkObject((DWORD)n.netId);
        if (targetObj)
        {
            if (!IsServerPlayer(targetObj))
            {
                gServerLogic.LogCheat(peerId_,99,true,"Trade","not player!");
                return;
            }
            obj_ServerPlayer* tplr = (obj_ServerPlayer*)targetObj;
            for (int i=0;i<72;i++)
            {
                tplr->TradeItems[i].Reset();
                tplr->isTradeAccept = false;
                tplr->TradeSlot[i] = -1;
            }
            PKT_C2S_TradeCancel_s n1;
            gServerLogic.p2pSendToPeer(tplr->peerId_,tplr,&n1,sizeof(n1));
        }
        for (int i=0;i<72;i++)
        {
            this->TradeItems[i].Reset();
            this->isTradeAccept = false;
            this->TradeSlot[i] = -1;
        }
    }
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_TradeOptoBack_s& n)
    {
        if (isTradeAccept) 
        {
            gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_Data, true, "isTradeAccept");
            return;
        }
    
    
        GameObject* targetObj = GameWorld().GetNetworkObject((DWORD)n.netId);
        if (targetObj)
        {
            if (!IsServerPlayer(targetObj))
            {
                gServerLogic.LogCheat(peerId_,99,true,"Trade","not player!");
                return;
            }
    
    
            r3dOutToLog("Trade: OptoBack %s ItemID %d\n",userName,n.Item.itemID);
            //TradeItems[TradeNums].Reset();
            //TradeSlot[TradeNums] = -1;
    
    
            //if (TradeNums > 0)
            // TradeNums--;
    
    
            GameObject* obj = GameWorld().GetNetworkObject(Tradetargetid);
            if (IsServerPlayer(obj))
            {
                obj_ServerPlayer* plr = (obj_ServerPlayer*)obj;
                if (plr && plr->isTradeAccept)
                {
                    plr->isTradeAccept = false;
                    for (int i=0;i<72;i++)
                    {
                        plr->TradeItems[i].Reset();
                        plr->TradeSlot[i] = -1;
                    }
                }
            }
    
    
            isTradeAccept = false;
            for (int i=0;i<72;i++)
            {
                TradeItems[i].Reset();
                TradeSlot[i] = -1;
            }
    
    
            obj_ServerPlayer* tplr = (obj_ServerPlayer*)targetObj;
            PKT_C2S_TradeOptoBack_s n1;
            n1.Item = n.Item;
            n1.slotfrom = n.slotfrom;
            gServerLogic.p2pSendToPeer(tplr->peerId_,tplr,&n1,sizeof(n1));
        }
    }
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_TradeBacktoOp_s& n)
    {
        if (isTradeAccept) 
        {
            gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_Data, true, "isTradeAccept");
            return;
        }
    
    
        GameObject* targetObj = GameWorld().GetNetworkObject((DWORD)n.netId);
        if (targetObj)
        {
            if (!IsServerPlayer(targetObj))
            {
                gServerLogic.LogCheat(peerId_,99,true,"Trade","not player!");
                return;
            }
    
    
            r3dOutToLog("Trade: BackToOp %s ItemID %d\n",userName,n.Item.itemID);
    
    
            //TradeItems[TradeNums].Reset();
            //TradeItems[TradeNums] = n.Item;
            //TradeSlot[TradeNums] = n.slotto;
            //TradeNums++;
    
    
            GameObject* obj = GameWorld().GetNetworkObject(Tradetargetid);
            if (IsServerPlayer(obj))
            {
                obj_ServerPlayer* plr = (obj_ServerPlayer*)obj;
                if (plr && plr->isTradeAccept)
                {
                    plr->isTradeAccept = false;
                    for (int i=0;i<72;i++)
                    {
                        plr->TradeItems[i].Reset();
                        plr->TradeSlot[i] = -1;
                    }
                }
            }
    
    
            isTradeAccept = false;
            for (int i=0;i<72;i++)
            {
                TradeItems[i].Reset();
                TradeSlot[i] = -1;
            }
    
    
            obj_ServerPlayer* tplr = (obj_ServerPlayer*)targetObj;
            PKT_C2S_TradeBacktoOp_s n1;
            n1.Item = n.Item;
            n1.slotto = n.slotto;
            gServerLogic.p2pSendToPeer(tplr->peerId_,tplr,&n1,sizeof(n1));
        }
    }
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_TradeRequest_s& n)
    {
        GameObject* targetObj = GameWorld().GetNetworkObject((DWORD)n.netId);
        if (targetObj)
        {
            if (!IsServerPlayer(targetObj))
            {
                gServerLogic.LogCheat(peerId_,99,true,"Trade","not player!");
                return;
            }
            obj_ServerPlayer* tplr = (obj_ServerPlayer*)targetObj;
            PKT_C2S_TradeRequest_s n1;
            n1.netId = (int)this->GetNetworkID();
            gServerLogic.p2pSendToPeer(tplr->peerId_,tplr,&n1,sizeof(n1));
        }
    }
    void obj_ServerPlayer::OnNetPacket(const PKT_C2S_TradeAccept2_s& n)
    {
        // stored data
    
    
        if (isTradeAccept) 
        {
            gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_Data, true, "isTradeAccept");
            return;
        }
    
    
        for (int i=0;i<72; i++)
        {
            TradeItems[i] = n.Item[i];
            TradeSlot[i] = n.slot[i];
        }
    
    
        this->Tradetargetid = (DWORD)n.netId;
        this->isTradeAccept = true;
        // the trading will start in Update() now we will wait a other player
    
    
        GameObject* targetObj = GameWorld().GetNetworkObject((DWORD)n.netId);
        if (targetObj && IsServerPlayer(targetObj))
        {
            obj_ServerPlayer * plr = (obj_ServerPlayer*)targetObj;
            PKT_C2S_TradeAccept2_s n1;
            gServerLogic.p2pSendToPeer(plr->peerId_,plr,&n1,sizeof(n1));
        }
    }
    Under:
    Code:
    switch(EventID)
        {
            DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_PlayerWeapDataRep);
            DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2C_PlayerJump);
    Add:
    Code:
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeAccept);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeCancel);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeOptoBack);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeRequest);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeAccept2);
    DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_TradeBacktoOp);
    In WarZ_Server.sln --> obj_ServerPlayer.h

    Under:
    Code:
    void        DoDeath();
    Add:
    Code:
    int TradeNums;
    Under:
    Code:
    r3dPoint3D prevpos;    r3dPoint3D tpos;
    Add:
    Code:
    DWORD Tradetargetid;
        wiInventoryItem TradeItems[72];
    Under:
    Code:
    void OnNetPacket(const PKT_C2S_PlayerState_s& n);
    Add:
    Code:
    void OnNetPacket(const PKT_C2S_TradeAccept_s& n);
    void OnNetPacket(const PKT_C2S_TradeRequest_s& n);
    void OnNetPacket(const PKT_C2S_TradeAccept2_s& n);
    void OnNetPacket(const PKT_C2S_TradeCancel_s& n);
    void OnNetPacket(const PKT_C2S_TradeBacktoOp_s& n);
    void OnNetPacket(const PKT_C2S_TradeOptoBack_s& n);
    bool isTradeAccept;
    void DoTrade(obj_ServerPlayer* plr , obj_ServerPlayer* plr2);
    bool IsItemCanAddToInventory(const wiInventoryItem& wi1);
    int TradeSlot[72]; // for check cheat engine;
    In WarZ_Server.sln --> AsyncFuncs.cpp

    Under:
    Code:
    void CJobSrvBuyItem::OnSuccess()
    {
        if (ResultCode != 0)
        {
            PKT_C2S_BuyItemAns_s n1;
            n1.ansCode = 1;
            gServerLogic.p2pSendRawToPeer(plr->peerId_,&n1,sizeof(n1));
            return;
        }
    
    
        if (store.pricePerm > 0)
            plr->profile_.ProfileData.GamePoints -= store.pricePerm;
        else if (store.gd_pricePerm > 0)
            plr->profile_.ProfileData.GameDollars -= store.gd_pricePerm;
    
    
        plr->BackpackAddItem(item);
        gServerLogic.ApiPlayerUpdateChar(plr);
    
    
        PKT_C2S_BuyItemAns_s n1;
        n1.ansCode = 0;
        gServerLogic.p2pSendRawToPeer(plr->peerId_,&n1,sizeof(n1));
    }
    Add:
    Code:
    CJobTradeLog::CJobTradeLog(int customerid , int customerid2 , int loadoutid,int loadoutid2 ,const char* gmt ,const char* gmt2, int GameServerId , wiInventoryItem wi) : CAsyncApiJob()
    {
        gamesid = GameServerId;
        item = wi;
        customerid1 = customerid;
        customerid22 = customerid2;
        loadoutid1 = loadoutid;
        loadoutid22 = loadoutid2;
        sprintf(gmt1,gmt);
        sprintf(gmt22,gmt2);
    }
    int CJobTradeLog::Exec()
    {
        CWOBackendReq req("api_SrvTradeLog.aspx");
        char msg[512];
        sprintf(msg,"%d -> %d",customerid1,customerid22);
        req.AddParam("CustomerID",  msg);
        sprintf(msg,"%d -> %d",loadoutid1,loadoutid22);
        req.AddParam("CharID",  msg);
        sprintf(msg,"%s -> %s",gmt1,gmt22);
        req.AddParam("Gamertag",  msg);
        sprintf(msg,"%d , %d",(int)item.InventoryID,(int)item.itemID);
        req.AddParam("ItemID",  msg);
        sprintf(msg,"%d , Var1 %d, Var2 %d",item.quantity,item.Var1,item.Var2);
        req.AddParam("quantity",  msg);
        req.AddParam("GameServerId",  gamesid);
    
    
        if (!req.Issue())
            r3dOutToLog("CJobTradeLog Failed. Code %d\n",req.resultCode_);
        else
            r3dOutToLog("CJobTradeLog %d Success\n",CustomerID);
    
    
        return 0;
    }
    
    
    void CJobTradeLog::OnSuccess()
    {
    
    
    }
    In WarZ_Server.sln --> AsyncFuncs.h

    Under:

    Code:
    class CJobSrvBuyItem : public CAsyncApiJob{
      public:
          CJobSrvBuyItem(obj_ServerPlayer* p,wiInventoryItem w,wiStoreItem s);
          wiInventoryItem item;
          obj_ServerPlayer* plr;
          wiStoreItem store;
         
    
    
          int        Exec();
          void        OnSuccess();
    };
    Add:
    Code:
    class CJobTradeLog : public CAsyncApiJob
    {
    
    
      public:
        CJobTradeLog(int customerid , int customerid2 , int loadoutid,int loadoutid2 ,const char* gmt ,const char* gmt2, int GameServerId , wiInventoryItem wi);
        char reason[512];
        int gamesid;
        int customerid1 , customerid22 , loadoutid1 , loadoutid22 ;
        char gmt1[512]; 
        char gmt22[512];
        wiInventoryItem item;
    
    
        int        Exec();
        void        OnSuccess();
    };
    Last edited by Laenoar; 12-07-14 at 06:51 PM.


  2. #2
    Registered sibercoder is offline
    MemberRank
    Sep 2013 Join Date
    24Posts

    Re: [Release] Trade System


  3. #3
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,439Posts

    Re: [Release] Trade System

    @sibercoder

    I deleted your post and am recreating it without all the extra CRAP inside the link. Don't do it again.

    Modified the link to Correctly go Directly to the Facebook video page without all the extra "like", "ads", etc

    https://www.facebook.com/photo.php?v=676215565790714


    Please do not create links with embedded ads or Like suggestions forcing members to auto-Like a page
    If you are talking to someone pretending to be me aka DNC, you're about to be scammed.
    Do not come to this forum complaining that you were scammed; when buying, selling, trading files is against forum rules.
    Don't point a finger at me, I am not talking with anyone.

  4. #4
    Banned m70b1jr is offline
    BannedRank
    May 2013 Join Date
    North CarolinaLocation
    856Posts

    Re: [Release] Trade System

    Nice. I know you have the new aomsin source. Release that next! :D

  5. #5
    Registered sibercoder is offline
    MemberRank
    Sep 2013 Join Date
    24Posts

    Re: [Release] Trade System

    Code:
    DoRemoveItems
    
    Not Found?

  6. #6
    Hardcore Member Mateuus is offline
    MemberRank
    Mar 2013 Join Date
    123Posts

    Re: [Release] Trade System

    Quote Originally Posted by sibercoder View Post
    Code:
    DoRemoveItems
    
    Not Found?
    use void RemoveAllItems but instead puts you to drop everything to drop only one

  7. #7
    ̶B̶a̶n̶n̶e̶d̶ Yuri-BR is offline
    True MemberRank
    Apr 2013 Join Date
    /etc/passwdLocation
    929Posts

    Re: [Release] Trade System

    Quote Originally Posted by sibercoder View Post
    Code:
    DoRemoveItems
    
    Not Found?
    Search for:
    Code:
    void obj_ServerPlayer::DoRemoveAllItems(obj_ServerPlayer* plr)
    {
    	for (int i =0;i<72;i++)
    	{
    		PKT_S2C_BackpackModify_s n;
    		n.SlotTo     = i;
    		n.Quantity   = 0;
    		n.dbg_ItemID = plr->loadout_->Items[i].itemID;
    		gServerLogic.p2pSendToPeer(plr->peerId_, plr, &n, sizeof(n));
    		plr->loadout_->Items[i].Reset();
    		plr->OnBackpackChanged(i);
    	}
    }
    Add Above:
    Code:
    void obj_ServerPlayer::DoRemoveItems(int slotid)
    {
    	PKT_S2C_BackpackModify_s n;
    	n.SlotTo     = slotid;
    	n.Quantity   = 0;
    	n.dbg_ItemID = loadout_->Items[slotid].itemID;
    	gServerLogic.p2pSendToPeer(peerId_, this, &n, sizeof(n));
    	loadout_->Items[slotid].Reset();
    	OnBackpackChanged(slotid);
    }
    - - - Updated - - -

    Search for:
    Code:
    void DoRemoveAllItems(obj_ServerPlayer* plr);
    Add above:
    Code:
    void DoRemoveItems(int slotid);

  8. #8
    Account Upgraded | Title Enabled! Cryptopia is offline
    True MemberRank
    Oct 2013 Join Date
    HelveteLocation
    287Posts

    Re: [Release] Trade System

    This does not work for me on the community edition.
    Did anyone got it working on that?

    EDIT: fixed it lol.

    Thanks for release!
    Last edited by Cryptopia; 30-08-14 at 10:24 PM.

  9. #9
    Member budaihu is offline
    MemberRank
    Sep 2013 Join Date
    70Posts

    Re: [Release] Trade System

    Quote Originally Posted by Cryptopia View Post
    This does not work for me on the community edition.
    Did anyone got it working on that?

    EDIT: fixed it lol.

    Thanks for release!
    What is the fix? Because i cant see Hold E to trade!

  10. #10
    Account Upgraded | Title Enabled! Cryptopia is offline
    True MemberRank
    Oct 2013 Join Date
    HelveteLocation
    287Posts

    Re: [Release] Trade System

    redo everything at this function:
    void obj_Player::UpdateActionUI()
    if this does not work try to take the code from warzth v2

  11. #11
    Account Upgraded | Title Enabled! AlexRedd is offline
    True MemberRank
    Jan 2014 Join Date
    302Posts

    Re: [Release] Trade System

    Thanks for the release!
    But I have a problem. items not removed from backpack after the trade. visually items in a backpack.

  12. #12
    Account Upgraded | Title Enabled! AlexRedd is offline
    True MemberRank
    Jan 2014 Join Date
    302Posts

    Re: [Release] Trade System

    Problem solved!
    the whole thing in this PKT_LAST_PACKET_ID > 255

  13. #13
    Member ghbb is offline
    MemberRank
    Oct 2013 Join Date
    31Posts

    Re: [Release] Trade System

    ActivityZ support? I got Errors





Advertisement