public void UpdateUninitNpcInfo(S2c_aoi_syncnpc npcInfo)
 {
     for (int i = 0; i < this.entityCreate._players.Count; i++)
     {
         if (this.entityCreate._npcs[i].sync.rid == npcInfo.rid)
         {
             this.entityCreate._npcs[i].sync = npcInfo;
             break;
         }
     }
 }
    private static int get_comp(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncnpc s2c_aoi_syncnpc = (S2c_aoi_syncnpc)obj;
            int             comp            = s2c_aoi_syncnpc.comp;
            LuaDLL.lua_pushinteger(L, comp);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index comp on a nil value");
        }
        return(result);
    }
    private static int get_sync(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_addnpc  s2c_aoi_addnpc = (S2c_aoi_addnpc)obj;
            S2c_aoi_syncnpc sync           = s2c_aoi_addnpc.sync;
            ToLua.PushObject(L, sync);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index sync on a nil value");
        }
        return(result);
    }
    private static int set_shield_buffid(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncnpc s2c_aoi_syncnpc = (S2c_aoi_syncnpc)obj;
            int             shield_buffid   = (int)LuaDLL.luaL_checknumber(L, 2);
            s2c_aoi_syncnpc.shield_buffid = shield_buffid;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index shield_buffid on a nil value");
        }
        return(result);
    }
    private static int get_buff(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncnpc s2c_aoi_syncnpc = (S2c_aoi_syncnpc)obj;
            LuaTable        buff            = s2c_aoi_syncnpc.buff;
            ToLua.Push(L, buff);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index buff on a nil value");
        }
        return(result);
    }
    private static int set_rid(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncnpc s2c_aoi_syncnpc = (S2c_aoi_syncnpc)obj;
            string          rid             = ToLua.CheckString(L, 2);
            s2c_aoi_syncnpc.rid = rid;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index rid on a nil value");
        }
        return(result);
    }
    private static int get_name(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncnpc s2c_aoi_syncnpc = (S2c_aoi_syncnpc)obj;
            string          name            = s2c_aoi_syncnpc.name;
            LuaDLL.lua_pushstring(L, name);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index name on a nil value");
        }
        return(result);
    }
    private static int _CreateAoi_S2c_aoi_syncnpc(IntPtr L)
    {
        int result;

        try
        {
            if (LuaDLL.lua_gettop(L) == 0)
            {
                S2c_aoi_syncnpc o = new S2c_aoi_syncnpc();
                ToLua.PushObject(L, o);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Aoi.S2c_aoi_syncnpc.New");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    private void AsyncInitilizeEntity(Aoi_add_normalmsg nmsg, S2c_aoi_syncplayer syncPlayer, S2c_aoi_syncnpc syncNpc, string name, string ownerId, RoleManager.EntityType entityType, Action <GameObject> callback = null)
    {
        GameObject  go  = this._loadEntityRes(entityType, nmsg.rid);
        SceneEntity obj = null;

        if (go)
        {
            obj = go.GetComponent <SceneEntity>();
            Util.CallMethod("PLAYERLOADER", "SetXlsInfo", new object[]
            {
                obj,
                (int)entityType,
                nmsg.char_no,
                (syncPlayer == null) ? 0 : syncPlayer.isyunbiao
            });
            if (syncPlayer != null)
            {
                obj.SetData(nmsg.rid, nmsg.char_no, syncPlayer.sex, syncPlayer.speed, syncPlayer.weapon, syncPlayer.mount_model, syncPlayer.partnerhorse_model, syncPlayer.lingqin_model, syncPlayer.lingyi_model, syncPlayer.pet_model, syncPlayer.shenjian_model, syncPlayer.shenyi_model, syncPlayer.jingmai_model, syncPlayer.score, syncPlayer.up_mount, syncPlayer.up_horse, syncPlayer.fashion, syncPlayer.dazuo, 0, 0, syncPlayer.isyunbiao);
                obj.SetKeyValue("clubname", syncPlayer.clubname);
                obj.SetKeyValue("clubpost", syncPlayer.clubpost);
            }
            else
            {
                obj.SetData(nmsg.rid, nmsg.char_no, 0, 0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, syncNpc.shield_hp, syncNpc.shield_hpmax, 0);
            }
            int shape = (syncPlayer == null) ? syncNpc.shape : syncPlayer.shape;
            if (syncPlayer != null && syncPlayer.fashion > 0)
            {
                shape = syncPlayer.fashion;
            }
            int    grade     = (syncPlayer == null) ? syncNpc.grade : syncPlayer.grade;
            int    comp      = (syncPlayer == null) ? syncNpc.comp : syncPlayer.comp;
            bool   canAttack = syncPlayer != null || syncNpc.canattk == 1;
            string pkMode    = (syncPlayer == null) ? string.Empty : syncPlayer.pkinfo;
            this.AsyncLoadCharacter(go.transform, shape, entityType, obj, delegate(GameObject model, string prefabPath)
            {
                if (model == null)
                {
                    model        = Util.LoadBucket(go.transform);
                    obj.isBucket = true;
                }
                model.transform.localScale = Vector3.one;
                Vector3 pos = Util.Convert2RealPosition(nmsg.x, nmsg.y, nmsg.z);
                this.SetEntityInfo(go, model, pos, (syncPlayer == null) ? syncNpc.dir : syncPlayer.dir360, (syncPlayer == null) ? 0f : syncPlayer.speed, obj, name, grade, ownerId, comp, nmsg.hpmax, nmsg.hp, canAttack, entityType, pkMode);
                if (callback != null)
                {
                    callback(go);
                }
                if (syncPlayer != null)
                {
                    Util.CallMethod("PLAYERLOADER", "LoadOtherShape", new object[]
                    {
                        obj,
                        (int)entityType,
                        syncPlayer.shenjian_model,
                        syncPlayer.shenyi_model
                    });
                    if (obj.up_mount == 1)
                    {
                        obj.isRide = true;
                    }
                }
            });
            return;
        }
    }