Esempio n. 1
0
        public bool MapNpcGuid2UInt32(NPCInstance role)
        {
            if (role.SingleId != 0)
            {
                return(false);
            }
            NPCInstance temp;

            if (mTableNpcs.TryGetValue(role.Id, out temp))
            {
                return(false);
            }
            UInt32 singleId = 0;

            for (int count = 0; count < (UInt32)EIdIndexInfo.MaxNpcInPlanes; count++)
            {
                if (mSingeIdNPCs.TryGetValue(mNextNpcId, out temp) == false)
                {
                    singleId = mNextNpcId;
                    mNextNpcId++;
                    break;
                }
                else
                {
                    ++mNextNpcId;
                    if (mNextNpcId >= (UInt32)EIdIndexInfo.NpcEnd)
                    {
                        mNextNpcId = (UInt32)EIdIndexInfo.NpcStart;
                    }
                }
            }

            if (singleId == 0)
            {
                return(false);
            }
            role._SetSingleId(singleId);
            mTableNpcs.Add(role.Id, role);
            mSingeIdNPCs.Add(singleId, role);
            return(true);
        }
Esempio n. 2
0
 public void UnmapNpcGuid2UInt32(NPCInstance role)
 {
     mTableNpcs.Remove(role.Id);
     mSingeIdNPCs.Remove(role.SingleId);
     role._SetSingleId(0);
 }