| Mirage Source http://miragesource.net/forums/ |
|
| Shop Fix http://miragesource.net/forums/viewtopic.php?f=210&t=362 |
Page 1 of 1 |
| Author: | Leighland [ Tue Aug 08, 2006 11:35 pm ] |
| Post subject: | Shop Fix |
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 <= 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 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? |
|
| Author: | Dark Echo [ Wed Aug 09, 2006 7:20 am ] |
| Post subject: | |
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.. |
|
| Author: | Leighland [ Thu Aug 10, 2006 8:22 pm ] |
| Post subject: | |
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 ;/ |
|
| Author: | Lea [ Thu Aug 10, 2006 9:50 pm ] |
| Post subject: | |
Code: Function HasItem(ByVal Index As Long, ByVal ItemNum As Long, Optional DoNotWear As Boolean = False) As Long Dim i As Long HasItem = 0 ' Check for subscript out of range If IsPlaying(Index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Function End If For i = 1 To MAX_INV ' Check to see if the player has the item If GetPlayerInvItemNum(Index, i) = ItemNum Then If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Then HasItem = GetPlayerInvItemValue(Index, i) Else If DoNotWear = True Then If Player(Index).Char(Player(Index).CharNum).ArmorSlot = ItemNum Or Player(Index).Char(Player(Index).CharNum).WeaponSlot = ItemNum _ Or Player(Index).Char(Player(Index).CharNum).HelmetSlot = ItemNum Or Player(Index).Char(Player(Index).CharNum).ShieldSlot = ItemNum Then _ Exit Function End If HasItem = 1 End If Exit Function End If Next i End Function Code: ' Check if they have the item
If HasItem(Index, Shop(i).TradeItem(n).GiveItem, True) >= 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) Else Call PlayerMsg(Index, "Trade unsuccessful.", BrightRed) End If Untested, But I think it will do... Try it. |
|
| Author: | Lea [ Sat Aug 12, 2006 2:55 pm ] |
| Post subject: | |
Does this work for you, did you try it? |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|