Esempio n. 1
0
    public NpcTableItem GetItemByKey(int key)
    {
        NpcTableItem item = null;

        if (dics.ContainsKey(key))
        {
            dics.TryGetValue(key, out item);
        }
        return(item);
    }
Esempio n. 2
0
 static int AddItem(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         NpcTable     obj  = (NpcTable)ToLua.CheckObject <NpcTable>(L, 1);
         NpcTableItem arg0 = (NpcTableItem)ToLua.CheckObject <NpcTableItem>(L, 2);
         obj.AddItem(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 3
0
 static int GetItemByKey(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         NpcTable     obj  = (NpcTable)ToLua.CheckObject <NpcTable>(L, 1);
         int          arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         NpcTableItem o    = obj.GetItemByKey(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_isMainCharacter(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            NpcTableItem obj = (NpcTableItem)o;
            bool         ret = obj.isMainCharacter;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isMainCharacter on a nil value"));
        }
    }
    static int get_name(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            NpcTableItem obj = (NpcTableItem)o;
            string       ret = obj.name;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"));
        }
    }
    static int get_id(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            NpcTableItem obj = (NpcTableItem)o;
            int          ret = obj.id;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index id on a nil value"));
        }
    }
    static int set_itemid(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            NpcTableItem obj  = (NpcTableItem)o;
            int          arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.itemid = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index itemid on a nil value"));
        }
    }
    static int set_isMainCharacter(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            NpcTableItem obj  = (NpcTableItem)o;
            bool         arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.isMainCharacter = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isMainCharacter on a nil value"));
        }
    }
    static int set_name(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            NpcTableItem obj  = (NpcTableItem)o;
            string       arg0 = ToLua.CheckString(L, 2);
            obj.name = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"));
        }
    }
Esempio n. 10
0
    static int _CreateNpcTableItem(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                NpcTableItem obj = new NpcTableItem();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: NpcTableItem.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 11
0
 public void AddItem(NpcTableItem item)
 {
     items.Add(item);
 }