hectorgimenez / koolo

Diablo II Resurrected bot written in Go
MIT License
67 stars 38 forks source link

DCF657b committing in use #219

Closed jang9824 closed 2 months ago

jang9824 commented 2 months ago

Details

DCF657b committing in use 5/10 bug after 1303fc2 commit

1.Gambling bug (It's full of stock and there's no space, so I keep buying it even though it's not selling.)

  1. If tz is a jail (Endless Creation/Leave Loop)

  2. Sometimes it's fixed in a strange place in town or on a map, but it doesn't move (or die hunting on a given map, unable to find his way, constantly getting hit by monsters, and running teleport in place)

Prior to 1303fc2 commit, all three of the above worked well

! Error after 1303fc2 Roll back to 549ae00 commit and work normally

!! Symptoms such as 1.2.3 above after the latest dcf657b run

!!! Even rollback to 549ae00 after dcf657b is updated, symptoms similar to 1.2.3.

DCF657b After the character dies, the potion on the belt Unorganized because stored in inventory (I've died two or three times and I'm hunting with a full potion in my inventory)

Sometimes it operates unspecified terrorist zones other than jail (endless creation/departure loop)

Version

DCF657b,549ae00,1303fc2

dmelia commented 2 months ago

Make sure you have assigned a button to use portal, that's probably why your bot is stuck on doing right clicks with teleport after clearing a zone. I fixed the gambling bug in my code, however, I still get a bug where the bot does a left click to try and buy the item instead of a right click on first try to buy the item. Here's the code at line 123 in gambling.go : return []step.Step{ step.SyncStep(func(d game.Data) error { b.sm.GambleItem(itm, 1) itemBought = itm currentIdx++ return nil }), step.SyncStep(func(d game.Data) error { town.ShopManager.SellJunk(b.sm, d) return nil }), }

jang9824 commented 2 months ago

Portal is specified I'll refer to the code you showed me The above bug is always happening for gambling bugs. The 2 and 3 are occurring intermittently

포털을 사용하기 위한 버튼을 할당했는지 확인하십시오. 아마도 영역을 지운 후 봇이 순간 이동으로 오른쪽 클릭을 하는 데 멈춘 이유일 것입니다. 내 코드에서 도박 버그를 수정했지만, 항목을 구입하려고 처음 시도할 때 마우스 오른쪽 버튼을 클릭하는 대신 봇이 항목을 구입하기 위해 왼쪽 클릭을 하는 버그가 여전히 발생합니다. gaming.go의 123번째 줄에 있는 코드는 다음과 같습니다. return []step.Step{ step.SyncStep(func(d game.Data) error { b.sm.GambleItem(itm, 1) itemBought = itm currentIdx++ return nil }), step.SyncStep(func(d game.Data) error { town.ShopManager.SellJunk(b.sm, d) return nil }), }

dmelia commented 2 months ago

After spending some time checking the Gambling function, i have solved the problem with it, here's my code : `func (b Builder) gambleItems() StepChainAction { currentIdx := 0 lastStep := false return NewStepChain(func(d game.Data) []step.Step { if lastStep { if d.OpenMenus.Inventory { return []step.Step{step.SyncStep(func(d game.Data) error { b.HID.PressKey(win.VK_ESCAPE) return nil })} }

        b.Logger.Info("Finished gambling", slog.Int("currentGold", d.PlayerUnit.TotalGold()))

        return nil
    }

    if d.PlayerUnit.TotalGold() < 500000 {
        lastStep = true
        return []step.Step{step.Wait(time.Millisecond * 200)}
    }

    for idx, itmName := range d.CharacterCfg.Gambling.Items {
        // Let's try to get one of each every time
        if currentIdx == len(d.CharacterCfg.Gambling.Items) {
            currentIdx = 0
        }

        if currentIdx > idx {
            continue
        }

        itm, found := d.Items.Find(itmName, item.LocationVendor)
        if !found {
            b.Logger.Debug("Item not found in gambling window, refreshing...", slog.String("item", string(itmName)))

            return []step.Step{step.SyncStep(func(d game.Data) error {
                b.HID.Click(game.LeftButton, ui.GambleRefreshButtonX, ui.GambleRefreshButtonY)
                return nil
            }),
                step.Wait(time.Millisecond * 500),
            }
        }

        return []step.Step{
            step.SyncStep(func(d game.Data) error {
                b.sm.BuyItem(itm, 1)
                currentIdx++
                return nil
            }),
            step.SyncStep(func(d game.Data) error {
                town.ShopManager.SellJunk(b.sm, d)
                return nil
            }),
        }
    }

    return nil
}, RepeatUntilNoSteps())

}`

hectorgimenez commented 2 months ago

gambling should be fixed now

jang9824 commented 2 months ago

도박은 이제 고쳐져야 한다

Thank you always