Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Items dropped from NPCS


Snoozey
 Share

Recommended Posts

The code is 1 damage = 1 threat, but I think if you raelly want to use it to it's fullest potential you need things like taunts to get lots of aggrivation as warrior tank, since as the tank you should not do more damage than the mage, but you should still be the one with the threat. The basic tutorial is 1 damage = 1 threat though.
Link to comment
Share on other sites

@Soul:

> I imagine that the reason this was never added was because of parties. If you don't want to use Joost's threat system, you should add a party condition to the "lock", and then check if the player is in a party. If they are, then allow it so that anyone in the party can pick it up.
>
> However, this still puts mages and healers at a disadvantage. If the tanks decide to keep all the loot, they can take it and run off. Also, what if a mage item and a warrior item, both bind on pickup, are on the ground? What dictates who should get which item?
>
> Overall, a smarter loot system is needed. Perhaps a combination of Joost's system, as well as a loot system that automatically awards items directly to the player's inventory. For example, if a boss is killed, it will go through the "threat list". Starting at the highest threat, it rewards items based on class, or randomly/evenly if there is no class set.
>
> You could also extend this to items on the ground. When a player wants to pick up an item, an algorithm is run deciding which item the player most likely wants. It could use class or level to determine this. (I believe Crystalshire has a system which warns you if you are picking up a BoP item that is not for your class.)
>
> So overall, you'd probably need to modify the actual loot system itself in order to completely remove unfairness.

I never really got what the binds did. Could you explain it?
Link to comment
Share on other sites

Thats what i thought they did. I tested this half a year ago by setting the bind type, wielding or picking up the item, attacking something with it if it was wieldable,  and then trying to trade it to other players. It didnt work before and it doesnt work now. Is it a bug? Or am i doing something wrong?
Link to comment
Share on other sites

If you add

```
If GetPlayerInvItemNum(Index, invNum)).BindType > 0 then
Call PlayerMsg(index), "You cant drop this item, you douchebag", BrightCyan)
Exit sub
End if
```
To the HandleMapDropItem sub and to HandleAcceptTrade sub you'll make it impossible to drop/trade any item that is either BoE or BoP. To track BoE items properly we need to track if they have been equipped before and there's no code in Eclipse at the moment to do that.
Link to comment
Share on other sites

@Joost:

> If you add
>
> ```
> If GetPlayerInvItemNum(Index, invNum)).BindType > 0 then
> Call PlayerMsg(index), "You cant drop this item, you douchebag", BrightCyan)
> Exit sub
> End if
> ```
> To the HandleMapDropItem sub and to HandleAcceptTrade sub you'll make it impossible to drop/trade any item that is either BoE or BoP. To track BoE items properly we need to track if they have been equipped before and there's no code in Eclipse at the moment to do that.

Just to fix the code up a bit, you have two )'s where there should be one.
I also changed the text to
>! Call PlayerMsg(index, "This item can't be dropped!", BrightRed) so that it doesnt have an error.

Then i try to compile and it gives me an error.

GetPlayerInvItem is not defined. Any help?
Link to comment
Share on other sites

You are correct. I changed it because it gave me an error when i compiled.

When i added the code i deleted a ) and i get this error.

![](http://i50.tinypic.com/5kp0fa.jpg)

So i changed the text to the one above and then it all looked good. Then i compiled and got this

![](http://i48.tinypic.com/29llbog.png)
Link to comment
Share on other sites

@Sigridunset:

The issue is that GetPlayerInvItemNum returns a number, not an item. Instead, use:
```
If Item(GetPlayerInvItemNum(index, invNum)).BindType > 0 Then

```
BUT WAIT, THERE'S MORE:

You should put this after:
```
If GetPlayerInvItemNum(index, invNum) < 1 Or { MORE CODE HERE } Then Exit Sub

```
Someone could send a "bad packet", where invNum is negative. This would cause the server to crash. If you move it, then the error is prevented.
Link to comment
Share on other sites

I'm a bit confused by your advice Soul. Where exactly do i place the
>! If GetPlayerInvItemNum(index, invNum) < 1 Or { MORE CODE HERE } Then Exit Sub
and what do i move?

here is my sub now

>! ' ::::::::::::::::::::::::::::::::::::::::::::
' :: Player trying to drop something packet ::
' ::::::::::::::::::::::::::::::::::::::::::::
Sub HandleMapDropItem(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim invNum As Long
    Dim amount As Long
    Dim Buffer As clsBuffer
    Set Buffer = New clsBuffer

    Buffer.WriteBytes Data()
    invNum = Buffer.ReadLong 'CLng(Parse(1))
    amount = Buffer.ReadLong 'CLng(Parse(2))
    Set Buffer = Nothing

    If Item(GetPlayerInvItem(index, invNum)).BindType > 0 Then
    If GetPlayerInvItemNum(index, invNum) < 1 Or 2000000000 > GetPlayerInvItemNum(index, invNum) Then
        Call PlayerMsg(index, "This item can't be dropped!", BrightRed)
    End If
>!     If TempPlayer(index).InBank Or TempPlayer(index).InShop Then Exit Sub
>!     ' Prevent hacking
    If invNum < 1 Or invNum > MAX_INV Then Exit Sub

    If GetPlayerInvItemNum(index, invNum) < 1 Or GetPlayerInvItemNum(index, invNum) > MAX_ITEMS Then Exit Sub

    If Item(GetPlayerInvItemNum(index, invNum)).Type = ITEM_TYPE_CURRENCY Then
        If amount < 1 Or amount > GetPlayerInvItemValue(index, invNum) Then Exit Sub
    End If

    ' everything worked out fine
    Call PlayerMapDropItem(index, invNum, amount)
End Sub
Link to comment
Share on other sites

@Sigridunset:

> I'm a bit confused by your advice Soul. Where exactly do i place the
> >! If GetPlayerInvItemNum(index, invNum) < 1 Or { MORE CODE HERE } Then Exit Sub
> and what do i move?

Reread that.

```
' ::::::::::::::::::::::::::::::::::::::::::::
' :: Player trying to drop something packet ::
' ::::::::::::::::::::::::::::::::::::::::::::
Sub HandleMapDropItem(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim invNum As Long
    Dim amount As Long
    Dim Buffer As clsBuffer
    Set Buffer = New clsBuffer

    Buffer.WriteBytes Data()
    invNum = Buffer.ReadLong 'CLng(Parse(1))
    amount = Buffer.ReadLong 'CLng(Parse(2))
    Set Buffer = Nothing

    If TempPlayer(index).InBank Or TempPlayer(index).InShop Then Exit Sub

    ' Prevent hacking
    If invNum < 1 Or invNum > MAX_INV Then Exit Sub

    If GetPlayerInvItemNum(index, invNum) < 1 Or GetPlayerInvItemNum(index, invNum) > MAX_ITEMS Then Exit Sub

    If Item(GetPlayerInvItemNum(index, invNum)).BindType > 0 Then
        Call PlayerMsg(index, "This item can't be dropped!", BrightRed)
        Exit Sub
    End If

    If Item(GetPlayerInvItemNum(index, invNum)).Type = ITEM_TYPE_CURRENCY Then
        If amount < 1 Or amount > GetPlayerInvItemValue(index, invNum) Then Exit Sub
    End If

    ' everything worked out fine
    Call PlayerMapDropItem(index, invNum, amount)
End Sub

```
Also, what's this line:
```
    If GetPlayerInvItemNum(index, invNum) < 1 Or 2000000000 > GetPlayerInvItemNum(index, invNum) Then

```
I removed it from the final code. I have no idea what you were trying to do, since that was already covered by this line:
```
    If GetPlayerInvItemNum(index, invNum) < 1 Or GetPlayerInvItemNum(index, invNum) > MAX_ITEMS Then Exit Sub

```
I'm not sure you actual realize what this code does.
Link to comment
Share on other sites

You are correct. I had no idea what the purpose of
```
If GetPlayerInvItemNum(index, invNum) < 1 Or { MORE CODE HERE } Then Exit Sub
```was.

I saw you changed the code. Is this the fixed version of my sub? I assumed it to be so, so i replaced by sub with it.

it gave me the error over

```
    If Item([b]GetPlayerInvItem[/b](index, invNum)).BindType > 0 Then
        Call PlayerMsg(index, "This item can't be dropped!", BrightRed)
        Exit Sub
    End If
```
Link to comment
Share on other sites

@Sigridunset:

> it gave me the error over
>
> ```
>     If Item([b]GetPlayerInvItem[/b](index, invNum)).BindType > 0 Then
>         Call PlayerMsg(index, "This item can't be dropped!", BrightRed)
>         Exit Sub
>     End If
> ```

Sorry about that, small typo. Try it again.

* * *

Anyway, time to explain what I meant by:
```
If GetPlayerInvItemNum(index, invNum) < 1 Or { MORE CODE HERE } Then Exit Sub

```
In that sub, search for:
```
If GetPlayerInvItemNum(index, invNum) < 1 Or

```
right below that is where you should have put the code. I already did so for you in the fixed version of the sub. The reason for {MORE CODE HERE} was to show that there was more code which I did not type because I was lazy.
Link to comment
Share on other sites

Ah now it makes sense! When i read "Put this after:" I understood put this code:```
If GetPlayerInvItemNum(index, invNum) < 1 Or { MORE CODE HERE } Then Exit Sub
```after this one:```
    If Item(GetPlayerInvItemNum(index, invNum)).BindType > 0 Then
        Call PlayerMsg(index, "This item can't be dropped!", BrightRed)
        Exit Sub
    End If
```
I assumed you wanted me to figure what comes next on my own, so that explains the```
    If GetPlayerInvItemNum(index, invNum) < 1 Or 2000000000 > GetPlayerInvItemNum(index, invNum) Then
```
In short, me misreading the whole thing xD Sorry!
Link to comment
Share on other sites

I'm trying to put this into trading, but when i paste the code

    If Item(GetPlayerInvItemNum(index, invNum)).BindType > 0 Then
        Call PlayerMsg(index, "This item can't be dropped!", BrightRed)
        Exit Sub
    End If

Into handle accept trade, it doesnt work. It gives me an error. :(
Link to comment
Share on other sites

@Joost:

> –---
> Im fairly sure the trade system is shit, you'll have to loop through MAX_INV and find out if the item is being traded that way, and then check the bindtype

Don't check if the item is Bo(P/E) at the end of the trade, do it when they attempt to trade it.

* * *

Server-side.

Find:
```
    If itemnum <= 0 Or itemnum > MAX_ITEMS Then Exit Sub

```
afterwards add:
```
    If Item(itemnum).BindType > 0 Then
        Call PlayerMsg(index, "This item can't be traded!", BrightRed)
        Exit Sub
    End If

```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...