Files

70 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LeoEnv.js — handler() (satır 98)
[← LeoEnv.js](index.md) · [← Master](../../wiki.md)
Parça 1/2 · [sonraki](handler-2.md)
```javascript
function handler(c)
{
var uiContext = c.getSubject().getUIContext();
if (!uiContext || uiContext.isClosed()) return;
var last = uiContext.getLast();
var oyuncu = c.getSubject();
var states = oyuncu.getStates();
if (last === "kapat") { oyuncu.closeUI(); return; }
if (last === "click")
{
var data = uiContext.getData();
var list = data.getList("click");
var mx = Math.floor(list.getFloat(0));
var my = Math.floor(list.getFloat(1));
// slot hesapla
if (my >= 38 && my <= 170)
{
var col = Math.floor((mx - 10) / 33);
var row = Math.floor((my - 38) / 33);
if (col >= 0 && col < 9 && row >= 0 && row < 4)
{
var slot = row * 9 + col;
var item = oyuncu.getInventory().getStack(slot);
if (item && !item.isEmpty())
{
states.setString("secili_slot", "" + slot);
envanterCiz(uiContext, states, oyuncu);
}
}
}
return;
}
if (last === "kopyala")
{
var secili = parseInt(states.getString("secili_slot"));
if (secili < 0)
{
var g = uiContext.get("panel");
g.removeAll();
envanterCiz(uiContext, states, oyuncu);
return;
}
var inv = oyuncu.getInventory();
var item = inv.getStack(secili);
if (!item || item.isEmpty())
{
states.setString("secili_slot", "-1");
envanterCiz(uiContext, states, oyuncu);
return;
}
// boş slot bul
```