Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shop Fix
#1
How can I stop the shops from selling worn equipment?

Here's what the packet looks like:

Code:
' ::::::::::::::::::::::::::
    ' :: Trade request packet ::
    ' ::::::::::::::::::::::::::
    If LCase$(Parse(0)) = "traderequest" Then
        ' Trade num
        n = Val(Parse(1))
        
        ' Prevent hacking
        If (n  MAX_TRADES) Then
            Call HackingAttempt(Index, "Trade Request Modification")
            Exit Sub
        End If
        
        ' Index for shop
        i = Map(GetPlayerMap(Index)).Shop
        
        ' Check if inv full
        X = FindOpenInvSlot(Index, Shop(i).TradeItem(n).GetItem)
        If X = 0 Then
            Call PlayerMsg(Index, "Trade unsuccessful, inventory full.", BrightRed)
            Exit Sub
        End If

        If HasItem(Index, Shop(i).traditem(n).GiveItem) >= Shop(i).TradeItem(n).GiveValue Then
            Call TakeItem(Index, Shop(i).TradeItem(n).GiveItem, Shop(i).TradeItem(n).GiveValue)
            Call GiveItem(Index, Shop(i).TradeItem(n).GetItem, Shop(i).TradeItem(n).GetValue)
            Call PlayerMsg(Index, "The trade was successful!", BrightYellow)
            Exit Sub
        Else
            Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
        End If
        Exit Sub
    End If

I haven't done anything to it yet.. I tried last night and gave up...

An example of what I want to happen:

I have 2 bronze shields. I Equip Shield 1.
I then trade with a shop and try to sell a shield. Since shield 1 is equipped, it must bypass that shield, and sell the one that isn't equipped.

I tried different things and none seemed to work the way I wanted.

Any ideas?
Reply
#2
Code:
If HasItem(Index, Shop(i).traditem(n).GiveItem) >= Shop(i).TradeItem(n).GiveValue Then
            If GetPlayerArmorSlot(Index) = Shop(i).traditem(n).GiveItem Then
                Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
                Exit Sub
            End If
            If GetPlayerWeaponSlot(Index) = Shop(i).traditem(n).GiveItem Then
                Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
                Exit Sub
            End If
            If GetPlayerHelmetSlot(Index) = Shop(i).traditem(n).GiveItem Then
                Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
                Exit Sub
            End If
            If GetPlayerShieldSlot(Index) = Shop(i).traditem(n).GiveItem Then
                Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
                Exit Sub
            End If            
            Call TakeItem(Index, Shop(i).TradeItem(n).GiveItem, Shop(i).TradeItem(n).GiveValue)
            Call GiveItem(Index, Shop(i).TradeItem(n).GetItem, Shop(i).TradeItem(n).GetValue)
            Call PlayerMsg(Index, "The trade was successful!", BrightYellow)
            Exit Sub
        Else
            Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
        End If

See if that works..
Reply
#3
Nope... this is the most annoying thing I've tried to madify on this source...

I've tried blocking it in the Takeitem sub, the HasItem sub and in the packet handler... I'm stumped ;/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)