Mirage Source

Free ORPG making software.
It is currently Fri Apr 26, 2024 9:44 am

All times are UTC




Post new topic Reply to topic  [ 266 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject: Shop Items in stock...
PostPosted: Mon Jan 26, 2009 8:21 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
I've been screwing around for about thirty minutes, and this is what I managed. I haven't gotten to test it, but can you guy see anything that needs to be added/taken from it?

Code:
' ::::::::::::::::::::::::::
' :: Trade request packet ::
' ::::::::::::::::::::::::::
Sub HandleTradeRequest(ByVal Index As Long, _
                       ByRef Parse() As String)
    Dim n As Long
    Dim i As Long
    Dim x As Long
    Dim z As Long
    ' Trade num
    n = CLng(Parse(1))
   
    ' Prevent hacking
    If (n <= 0) Or (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 the Demand Increase and Decrease = 0 Then the stock = 10
    '(This is so that, an item that hasn't ever been bought, will be in stock)
    If Shop(i).TradeItem(n).DemandIncrease = 0 And Shop(i).TradeItem(n).DemandDecrease = 0 Then
        Shop(i).TradeItem(n).Stocked = 10
    End If
   
    If x = 0 Then
        Call PlayerMsg(Index, "Trade unsuccessful, inventory full.", BrightRed)
        Exit Sub
    End If

    'Check to see if they have on in stock
    If Shop(i).TradeItem(n).Stocked > 0 Then

        ' Check if they have the item
        If HasItem(Index, Shop(i).TradeItem(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!", Yellow)
            'Minus one from stock
            Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 1
            'Add moar demand
            Shop(i).TradeItem(n).DemandIncrease = Shop(i).TradeItem(n).DemandIncrease + 0.1
           
            'It's in high demand, lets give a stock increase of five.
            If Shop(i).TradeItem(n).DemandIncrease > 1 Then
                'Add five more to the current stock
                Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 5
            End If
           
            'No one buys it, why keep a high stock?
            If Shop(i).TradeItem(n).DemandDecrease >= 1 Then
                Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 5
            End If
        Else
            Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
        End If

    Else
        Call PlayerMsg(Index, "This item is not in stock, at the moment!", BrightRed)
    End If

End Sub

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Mon Jan 26, 2009 10:25 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
I did some chances, though I'm not sure if they'll work. :\

I need a way to make it check to see if anyone bought that item in the last day/game day.

10 minutes = 1 game hour

Code:
' ::::::::::::::::::::::::::
' :: Trade request packet ::
' ::::::::::::::::::::::::::
Sub HandleTradeRequest(ByVal Index As Long, _
                       ByRef Parse() As String)
    Dim n As Long
    Dim i As Long
    Dim x As Long
    Dim z As Long
    ' Trade num
    n = CLng(Parse(1))
   
    ' Prevent hacking
    If (n <= 0) Or (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 the Demand Increase and Decrease = 0 Then the stock = 10
    '(This is so that, an item that hasn't ever been bought, will be in stock)
    If Shop(i).TradeItem(n).DemandIncrease = 0 And Shop(i).TradeItem(n).DemandDecrease = 0 Then
        Shop(i).TradeItem(n).Stocked = 10
    End If
   
    If x = 0 Then
        Call PlayerMsg(Index, "Trade unsuccessful, inventory full.", BrightRed)
        Exit Sub
    End If

    'Check to see if they have on in stock
    If Shop(i).TradeItem(n).Stocked > 0 Then

        ' Check if they have the item
        If HasItem(Index, Shop(i).TradeItem(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!", Yellow)
            'Minus one from stock
            Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 1
            'Add moar demand
            Shop(i).TradeItem(n).DemandIncrease = Shop(i).TradeItem(n).DemandIncrease + 0.1
           
            Select Case Shop(i).TradeItem(n).DemandIncrease
           
                Case 1
               
                    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 5
               
                Case 5
                    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 10

                Case 10
                    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 20
            End Select
           
            'It's in high demand, lets give a stock increase of five.
            'If Shop(i).TradeItem(n).DemandIncrease > 1 Then
            '    'Add five more to the current stock
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 5
            'End If
            Select Case Shop(i).TradeItem(n).DemandDecrease
           
                Case 1
               
                    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 5
               
                Case 5
                    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 10

                Case 10
                    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked = 0
            End Select

            'No one buys it, why keep a high stock?
            'If Shop(i).TradeItem(n).DemandDecrease >= 1 Then
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 5
            'End If

        Else
            Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
        End If

    Else
        Call PlayerMsg(Index, "This item is not in stock, at the moment!", BrightRed)
    End If

End Sub

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Mon Jan 26, 2009 11:13 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Aug 17, 2006 5:27 pm
Posts: 866
Location: United Kingdom
I see what you are doing, and I quite like it.

The only thing I would change would be perhaps instead of checking for the restock each time its opened, check it every 10 minutes on the server - that way sometimes people may go to the shops and find what they want is actually out of stock, and have to come back 10 minutes later, instead of just closing the trade window and opening it again.

Nice work :3


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 12:11 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Fox wrote:
I see what you are doing, and I quite like it.

The only thing I would change would be perhaps instead of checking for the restock each time its opened, check it every 10 minutes on the server - that way sometimes people may go to the shops and find what they want is actually out of stock, and have to come back 10 minutes later, instead of just closing the trade window and opening it again.

Nice work :3


Thanks. Hmm. Could I do the check in the server loop? Could you maybe give an example? (I've never messed with the server loop)

Thanks for the response, I appreciate it.

Edit, I added this to server loop, that checks every ten minutes:

Code:
Private Sub UpdateShopStocks()
    Dim i As Long
    Dim N As Long

    For i = 1 To MAX_SHOPS
        For N = 1 To 8

            'Handle what to do if the demand increases
            Select Case Shop(i).TradeItem(N).DemandIncrease
           
                Case 1
                    'add the stock by five.
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 5
               
                Case 5
                    'add the stock by ten.
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 10
                   
                Case 10
                    'add the stock by twenty
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 20
            End Select
           
            'It's in high demand, lets give a stock increase of five.
            'If Shop(i).TradeItem(n).DemandIncrease > 1 Then
            '    'Add five more to the current stock
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 5
            'End If
           
            'Handle what to do if the demand decreases
            Select Case Shop(i).TradeItem(N).DemandDecrease
           
                Case 1
                    'minus the stock by five.
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 5
               
                Case 5
                    'minus the stock by 10
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 10

                Case 10
                    'NO stock at all
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked = 0
            End Select

            'No one buys it, why keep a high stock?
            'If Shop(i).TradeItem(n).DemandDecrease >= 1 Then
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 5
            'End If
        Next
    Next

End Sub


How's it look now?


Edit: When i try to save a shop, this gets highlighted:
Code:
Shop(ShopNum).TradeItem(i).GetValue = CLng(Parse(N + 3))


The CLng(Parse(N=3)) part is subscript out of range.

Edit2: Can get through without the subscript out of range now, Lets test this shall we?

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Last edited by Nean on Tue Jan 27, 2009 4:01 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 3:58 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
redim parse(n+3)

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:02 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Lea wrote:
redim parse(n+3)


I got it covered. :)) Thanks for the response ^^

Going to test now, I think.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:18 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
lol

that will let it compile, but it wont work right :D

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:21 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Lea wrote:
lol

that will let it compile, but it wont work right :D


Yeah, I didn't take your fix. I started over in a newer version, and was smarter about the changes I did, and it worked on it's own.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:25 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Really lol, never found the problem then?

_________________
I is back!


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:26 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
timster0 wrote:
Really lol, never found the problem then?


I'm pretty sure I was parsing wrong. :D

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:47 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Alright, I DONT FUCKING GET IT

Subscript out of range
Code:
Stocked = CLng(Parse(n + 4))


I've never had problems with it, until I added
Code:
         
Stocked = CLng(Parse(n + 4))
         Increase = CLng(Parse(n + 5))
         Decrease = CLng(Parse(n + 6))


To the client.

I have this in the server:
Code:
    For i = 1 To MAX_TRADES
        Shop(ShopNum).TradeItem(i).GiveItem = CLng(Parse(N))
        Shop(ShopNum).TradeItem(i).GiveValue = CLng(Parse(N + 1))
        Shop(ShopNum).TradeItem(i).GetItem = CLng(Parse(N + 2))
        Shop(ShopNum).TradeItem(i).GetValue = CLng(Parse(N + 3))
        Shop(ShopNum).TradeItem(i).Stocked = CLng(Parse(N + 4))
        Shop(ShopNum).TradeItem(i).DemandIncrease = CLng(Parse(N + 5))
        Shop(ShopNum).TradeItem(i).DemandDecrease = CLng(Parse(N + 6))
       
        N = N + 7
    Next


And this in the client:
Code:
     For i = 1 To MAX_TRADES
         GiveItem = CLng(Parse(n))
         GiveValue = CLng(Parse(n + 1))
         GetItem = CLng(Parse(n + 2))
         GetValue = CLng(Parse(n + 3))
         Stocked = CLng(Parse(n + 4))
         Increase = CLng(Parse(n + 5))
         Decrease = CLng(Parse(n + 6))
         
         If GiveItem > 0 Then
             If GetItem > 0 Then
                 frmTrade.lstTrade.AddItem "Give " & Trim$(Shop(ShopNum).Name) & " " & GiveValue & " " & Trim$(Item(GiveItem).Name) & " for " & Trim$(Item(GetItem).Name & "(" & Stocked & ")")
             End If
         End If
         n = n + 7


Everything seemed to work/compile correctly UNTIL I tried to get the quantity in stock show up in the shop, for each item.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 11:33 am 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
How are you sending it?


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 2:23 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Dugor wrote:
How are you sending it?


Code:
frmTrade.lstTrade.AddItem "Give " & Trim$(Shop(ShopNum).Name) & " " & GiveValue & " " & Trim$(Item(GiveItem).Name) & " for " & Trim$(Item(GetItem).Name & "(" & Stocked & ")")


That's why I wanted to finish the parsing on both sides, so that I could just do this, but I don't think it would work anyways, and now everythings all screwed because of something I did wrong.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Jan 27, 2009 4:18 pm 
Dugor helped me with a similar problem. I just changed the clng to val..


Top
  
 
PostPosted: Tue Jan 27, 2009 11:06 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Matt wrote:
Dugor helped me with a similar problem. I just changed the clng to val..


Same thing happens. I can't fucking figure this out. It's lame.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Wed Jan 28, 2009 12:02 am 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
I meant, what is the exact packet you are sending. I'm willing to bet you aren't sending the right amount of data.


Top
 Profile  
 
PostPosted: Wed Jan 28, 2009 12:09 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Dugor wrote:
I meant, what is the exact packet you are sending. I'm willing to bet you aren't sending the right amount of data.


Code:
Public Sub SendSaveShop(ByVal ShopNum As Long)
Dim Packet As String
Dim i As Long

    With Shop(ShopNum)
        Packet = CSaveShop & SEP_CHAR & ShopNum & SEP_CHAR & Trim$(.Name) & SEP_CHAR & Trim$(.JoinSay) & SEP_CHAR & Trim$(.LeaveSay) & SEP_CHAR & .FixesItems
    End With
   
    For i = 1 To MAX_TRADES
        With Shop(ShopNum).TradeItem(i)
            Packet = Packet & SEP_CHAR & .GiveItem & SEP_CHAR & .GiveValue & SEP_CHAR & .GetItem & SEP_CHAR & .GetValue & SEP_CHAR & .Stocked & SEP_CHAR & .DemandIncrease & SEP_CHAR & .DemandDecrease
        End With
    Next
   
    Packet = Packet & END_CHAR
    Call SendData(Packet)
End Sub


Does that help?

Only time i use it in a packet, I believe.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Wed Jan 28, 2009 11:19 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
I can't seem to edit shops now either. I get a RTE 9 on
Code:
GetItem = CLng(Parse(n + 2))


In HandleEditShop

Heres my edit shop:
Code:
' ::::::::::::::::::::::
' :: Edit shop packet ::
' ::::::::::::::::::::::
Sub HandleEditShop(ByRef Parse() As String)
Dim n As Long
Dim i As Long
Dim ShopNum As Long
Dim GiveItem As Long
Dim GiveValue As Long
Dim GetItem As Long
Dim GetValue As Long
Dim Stocked As Long
Dim Increase As Long
Dim Decrease As Long

     ShopNum = CLng(Parse(1))
     
     ' Update the shop
     Shop(ShopNum).Name = Parse(2)
     Shop(ShopNum).JoinSay = Parse(3)
     Shop(ShopNum).LeaveSay = Parse(4)
     Shop(ShopNum).FixesItems = CByte(Parse(5))
     
     n = 6
     For i = 1 To MAX_TRADES
         
         GiveItem = CLng(Parse(n))
         GiveValue = CLng(Parse(n + 1))
         GetItem = CLng(Parse(n + 2))
         GetValue = CLng(Parse(n + 3))
         Stocked = CLng(Parse(n + 4))
         
         Shop(ShopNum).TradeItem(i).GiveItem = GiveItem
         Shop(ShopNum).TradeItem(i).GiveValue = GiveValue
         Shop(ShopNum).TradeItem(i).GetItem = GetItem
         Shop(ShopNum).TradeItem(i).GetValue = GetValue
         Shop(ShopNum).TradeItem(i).Stocked = Stocked
         Shop(ShopNum).TradeItem(i).DemandIncrease = Increase
         Shop(ShopNum).TradeItem(i).DemandDecrease = Decrease
         
         n = n + 5
     Next
     
     ' Initialize the shop editor
     Call ShopEditorInit
     
End Sub


Code:
Public Sub SendSaveShop(ByVal ShopNum As Long)
Dim Packet As String
Dim i As Long

    With Shop(ShopNum)
        Packet = CSaveShop & SEP_CHAR & ShopNum & SEP_CHAR & Trim$(.Name) & SEP_CHAR & Trim$(.JoinSay) & SEP_CHAR & Trim$(.LeaveSay) & SEP_CHAR & .FixesItems
    End With
   
    For i = 1 To MAX_TRADES
        With Shop(ShopNum).TradeItem(i)
            Packet = Packet & SEP_CHAR & .GiveItem & SEP_CHAR & .GiveValue & SEP_CHAR & .GetItem & SEP_CHAR & .GetValue & SEP_CHAR & .Stocked & SEP_CHAR & .DemandIncrease & SEP_CHAR & .DemandDecrease
        End With
    Next
   
    Packet = Packet & END_CHAR
    Call SendData(Packet)
End Sub


Code:
' ::::::::::::::::::
' :: Trade packet ::
' ::::::::::::::::::
 Sub HandleTrade(ByRef Parse() As String)
 Dim n As Long
 Dim i As Long
 Dim ShopNum As Long
 Dim GiveItem As Long
 Dim GiveValue As Long
 Dim GetItem As Long
 Dim GetValue As Long
 Dim Stocked As Long
 Dim Increase As Long
 Dim Decrease As Long
 
     ShopNum = CLng(Parse(1))
     
     If CByte(Parse(2)) = 1 Then
         frmTrade.lblFixItem.Visible = True
     Else
         frmTrade.lblFixItem.Visible = False
     End If
     
     n = 3
     
     For i = 1 To MAX_TRADES
         GiveItem = CLng(Parse(n))
         GiveValue = CLng(Parse(n + 1))
         GetItem = CLng(Parse(n + 2))
         GetValue = CLng(Parse(n + 3))
         Stocked = CLng(Parse(n + 4))
         Increase = CLng(Parse(n + 5))
         Decrease = CLng(Parse(n + 6))
         
         If GiveItem > 0 Then
             If GetItem > 0 Then
                 frmTrade.lstTrade.AddItem "Give " & Trim$(Shop(ShopNum).Name) & " " & GiveValue & " " & Trim$(Item(GiveItem).Name) & " for " & Trim$(Item(GetItem).Name & "(" & Stocked & ")")
             End If
         End If
         n = n + 7
     Next
     
     If frmTrade.lstTrade.ListCount > 0 Then
         frmTrade.lstTrade.ListIndex = 0
     End If
     frmTrade.Show vbModal
End Sub


Server

Code:
' ::::::::::::::::::::::
' :: Save shop packet ::
' ::::::::::::::::::::::
Sub HandleSaveShop(ByVal Index As Long, ByRef Parse() As String)
Dim ShopNum As Long
Dim N As Long
Dim i As Long

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Call HackingAttempt(Index, "Admin Cloning")
        Exit Sub
    End If
   
    ShopNum = CLng(Parse(1))
   
    ' Prevent hacking
    If ShopNum < 0 Or ShopNum > MAX_SHOPS Then
        Call HackingAttempt(Index, "Invalid Shop Index")
        Exit Sub
    End If
   
    ' Update the shop
    Shop(ShopNum).Name = Parse(2)
    Shop(ShopNum).JoinSay = Parse(3)
    Shop(ShopNum).LeaveSay = Parse(4)
    Shop(ShopNum).FixesItems = CByte(Parse(5))
   
    N = 6
    For i = 1 To MAX_TRADES
        Shop(ShopNum).TradeItem(i).GiveItem = CLng(Parse(N))
        Shop(ShopNum).TradeItem(i).GiveValue = CLng(Parse(N + 1))
        Shop(ShopNum).TradeItem(i).GetItem = CLng(Parse(N + 2))
        Shop(ShopNum).TradeItem(i).GetValue = CLng(Parse(N + 3))
        Shop(ShopNum).TradeItem(i).Stocked = CLng(Parse(N + 4))
        Shop(ShopNum).TradeItem(i).DemandIncrease = CLng(Parse(N + 5))
        Shop(ShopNum).TradeItem(i).DemandDecrease = CLng(Parse(N + 6))
       
        N = N + 7
    Next
   
    ' Save it
    Call SendUpdateShopToAll(ShopNum)
    Call SaveShop(ShopNum)
    Call AddLog(GetPlayerName(Index) & " saving shop #" & ShopNum & ".", ADMIN_LOG)
End Sub


Code:
' ::::::::::::::::::::::::::
' :: Trade request packet ::
' ::::::::::::::::::::::::::
Sub HandleTradeRequest(ByVal Index As Long, _
                       ByRef Parse() As String)
    Dim N As Long
    Dim i As Long
    Dim x As Long
    Dim z As Long
    ' Trade num
    N = CLng(Parse(1))
   
    ' Prevent hacking
    If (N <= 0) Or (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 the Demand Increase and Decrease = 0 Then the stock = 10
    '(This is so that, an item that hasn't ever been bought, will be in stock)
    If Shop(i).TradeItem(N).DemandIncrease = 0 And Shop(i).TradeItem(N).DemandDecrease = 0 Then
        Shop(i).TradeItem(N).Stocked = 10
    End If
   
    If x = 0 Then
        Call PlayerMsg(Index, "Trade unsuccessful, inventory full.", BrightRed)
        Exit Sub
    End If

    'Check to see if they have on in stock
    If Shop(i).TradeItem(N).Stocked > 0 Then

        ' Check if they have the item
        If HasItem(Index, Shop(i).TradeItem(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!", Yellow)
            'Minus one from stock
            Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 1
            'Add moar demand
            Shop(i).TradeItem(N).DemandIncrease = Shop(i).TradeItem(N).DemandIncrease + 0.1
           
'            Select Case Shop(i).TradeItem(N).DemandIncrease
'
'                Case 1
'
'                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 5
'
'                Case 5
'                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 10
'
'                Case 10
'                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 20
'            End Select
'
'            'It's in high demand, lets give a stock increase of five.
'            'If Shop(i).TradeItem(n).DemandIncrease > 1 Then
'            '    'Add five more to the current stock
'            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 5
'            'End If
'            Select Case Shop(i).TradeItem(N).DemandDecrease
'
'                Case 1
'
'                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 5
'
'                Case 5
'                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 10
'
'                Case 10
'                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked = 0
'            End Select

            'No one buys it, why keep a high stock?
            'If Shop(i).TradeItem(n).DemandDecrease >= 1 Then
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 5
            'End If

        Else
            Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed)
        End If

    Else
        Call PlayerMsg(Index, "This item is not in stock, at the moment!", BrightRed)
    End If

End Sub


Code:
Private Sub UpdateShopStocks()
    Dim i As Long
    Dim N As Long

    For i = 1 To MAX_SHOPS
        For N = 1 To 8

            'Handle what to do if the demand increases
            Select Case Shop(i).TradeItem(N).DemandIncrease
           
                Case 1
                    'add the stock by five.
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 5
               
                Case 5
                    'add the stock by ten.
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 10
                   
                Case 10
                    'add the stock by twenty
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked + 20
            End Select
           
            'It's in high demand, lets give a stock increase of five.
            'If Shop(i).TradeItem(n).DemandIncrease > 1 Then
            '    'Add five more to the current stock
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked + 5
            'End If
           
            'Handle what to do if the demand decreases
            Select Case Shop(i).TradeItem(N).DemandDecrease
           
                Case 1
                    'minus the stock by five.
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 5
               
                Case 5
                    'minus the stock by 10
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked - 10

                Case 10
                    'NO stock at all
                    Shop(i).TradeItem(N).Stocked = Shop(i).TradeItem(N).Stocked = 0
            End Select

            'No one buys it, why keep a high stock?
            'If Shop(i).TradeItem(n).DemandDecrease >= 1 Then
            '    Shop(i).TradeItem(n).Stocked = Shop(i).TradeItem(n).Stocked - 5
            'End If
        Next
    Next

End Sub


Code:
        If Tick > LastUpdateShopStocks Then
            UpdateShopStocks
            LastUpdateShopStocks = GetTickCount + 600000
        End If

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Fri Jan 30, 2009 12:38 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Triple post o.O

Anyways GIAKEN helped me figure it out. It was so fucking obvious I'm ashamed to even post here anymore. I'll probably start a new topic with the new problems I have. :D

Someone lox this pl0x

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Dec 14, 2021 12:50 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 487894
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоsemiasphalticflux.ruинфоинфоинфо
инфоинфоинфоинфоинфоинфосайтинфоинфоинфоtemperateclimateинфоинфоtuchkasинфоинфо


Top
 Profile  
 
PostPosted: Thu Feb 10, 2022 2:24 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 487894
full144.5PERFBettEverToweKimiSummComeKabaNaruFlutMATLXVIITescAlfrRoseDevoTescTescErneWillPRES
RudoLaceTescTescPatrGreeJohnDreaPETEHeadPrecMichWestVaniKissExCePaleRexoKissRichSigmNaivFino
FranStriPushCotoBillOmsaFlestranDuttScotAnneSheiPostELEGSpliKhouElsyChadSilvNikiLegeCollPush
SonyFredVentMichGiorXVIIDougMiyoVentThorSwarLAPIAlexWindXVIIRusiZoneMichdiamRusiGuntPURERobe
UGANIdirWildClinAlbeGentZoneAlfrXVIIZoneXXIIWillArthRockStevZoneZoneJohnRighZoneJimmZonediam
XVIIAavisoliBioVShieDormStieBakuGradWorkWindEscaWildChicBradECSBDirtBlauMataBlauMicrtiffJazz
PoppEducCreaPaulLegePeugSmobWindWindMicrCariTefaClorSeduDarlInteVikrwwwrJeweLukiDouzVictpulp
LookKontXVIIAlbiVincHenrWinnHenrBullDougGaliThisGustCathXVIIwwwbUlriVerdJoseWindGrahSaleColo
ShamNokiClauDeutJeweOrigMichTotaAmazwwwaChilAstrDjVuRalfUlysThanToveLouiNighMoteWindBioVBioV
BioVIntrHousDaviDeepEfilcrosHellBornAbscVoakFranMicrtuchkasPhotCerv


Top
 Profile  
 
PostPosted: Sat Mar 12, 2022 2:02 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 487894
audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.ruсайтmailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru


Top
 Profile  
 
PostPosted: Wed Jun 15, 2022 3:14 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 487894
York306.5BettCHAPSomeShopfantBohuRichXIIISandDormAngeAtlaEllaDekoAngeStatSherKitcZoneRepoFred
SifrFionElseElseErbaPalmPenhJewePythNiveLyonXVIIGranCityOralBlenPlanRougGillPureAlaiRalpTrav
KissPrinRobeBrycVoguLycrBattJameHovablacEmpiJennJohaGeorBlitAphrDolbSelaviscSelaCircEasyArch
VoguTorcTorgLouiBarrGillIngmLuigAlexWindCentJeroCondArtsPureToveStouSoutZoneZoneVIIIBabyZone
SwarJackZoneMiyoLouiTonyEricJameXVIIRozaDigmLEGODynaHiFiRogeStriFranMicrGranMAXIFyodChogHalo
EasyAstoBretNTSCAutoPostZanuShirBookWindBookAlcoESPRDalvHellBestFlipFruiARAGGuitBructhisSmoo
HarrPrinRussWatesteaOrbiWindANGLBaldwwwnDigiBoscChouPumaChoiCatcAgatKonrFilmSiemSinsRichOmry
HuntPagaXVIIRoalContOrbiHenrSystSoniJameVIIIPULMChicXVIIMicrVasiSingMichClayModeIntrNancChar
ManhLatewwwbClarKareRaymJohnVenuHerbSextPoisRespRobeRobeMaryMillBegiDarrLuciVIIIGenuNTSCNTSC
NTSCAnitRETABirdEarlfoamBlueRossRobewwwrJackBeatFromtuchkasSpocRETA


Top
 Profile  
 
PostPosted: Sat Sep 10, 2022 8:51 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 487894
Bram196.81CHAPPERFBombDaviJasoLiviSusaBestSidePremNealTescElaiTescToneAtlaClarBistTintSapiBurd
RoseSorrFranclasNaivIrviMineMichAlicGregXVIIFiscStayJohnLadyOreaEmotFossOreaLindTescPalePaul
HiroRicaVoguWildHaleXVIISonyNikiJacqFounStreElegDeepOsirUptoMatiShelAlexVentElegGeorPushFlow
PushHenrPaliSelaJohnOxydDulaNasoFallAdioZoneMiyoSilvKoboBarrNasoZoneDiglHaruHansELEGZoneCant
SeymZoneLudwHomoBELSJeanASASZoneZoneZonePeteZoneZoneClifJeweZoneZoneZoneAstrChetZoneZoneZone
ZoneWedgCuviRitmNardElecSamsFullAmazMidnMissTropSandDriiPremLineMistARAGwwwpBriaURSSCardJazz
ENTRGrouStorRequBlueWarhDignWindWindWindRegaMoulChouPureBritJiriValeEricBlacKarlClauLiveSofi
DreaPremReneAcadArchErikDeniXVIIStatVeryIsaaTOTAXVIILuciUnitGoodFranMilaMonaPierUppeOrioDebe
RECOThomRobeGrahXXIINineDolbRobeChriEdgaAmplBRATWindOrgyMarcIncuJameElecBarbHansRichRitmRitm
RitmEtudSebaSoulSympStevInstFeatRudoThisJaquEphrBowmtuchkasMicrAndr


Top
 Profile  
 
PostPosted: Thu Nov 03, 2022 5:45 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 487894
Humo69.4BettBettKnowSlimRudyJackMotoAndrNoraMagmQuanMargPRESRogeSheeSkarTescApplJoseQuixTesc
TescZebrTrixZippCreoHearAloeCarlReflAloeEmanIrenambiToucBraiHydrKeraNiveNickLambFyodFiorOral
PeteBlacVoguOmsaGediComePearWorrNovaSideDahoBusiPhilElegXVIIRoxygreyNeriStriSelaELEGBambWilh
JeweKingXIIIDirtXVIIRamaFLCLRondSylvAfridiamZoneSignHappMazdChetZoneXXIIMiyoChetZoneStefZone
XVIIMileClivXVIIXVIIRothZoneXVIIMichHenrCantArchFromElisClauChetHeleboreLiveJohaLawrEdouXVII
SeanXVIIMadeTILTOutsGardSamsMickBookAlbeSolaChicEscaDesiPolaSideProfAdriPlaySchuLouipockFusi
ValiRaveEducmailBlanSylvCompHoocBarrSaleMagnBorkInteBossWhisDaviFranRideWindMPEGDizzNikoSubl
VideDolbXIIIFranCharAlanXVIIElsaTakeGlauLeonMicrIntrHearLordRollMarkIDSFStroIrenRollDaniLind
TeleCapoRichEnglDonaMiniThisGeorInstJeroHappPoisRetuAntoTOEFVendwwwaThomAutoFlyiWritTILTTILT
TILTBeauMarkAntoSilvLuciThinProjGordWillAlisChicJobstuchkasFritCoki


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 266 posts ]  Go to page 1, 2, 3, 4, 5 ... 11  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group