protected void DummyDead(uint dummyID, int x = 0, int y = 0)
        {
            if (!localServerEntity.ContainsKey(dummyID))
            {
                return;
            }

            if (localServerEntity[dummyID] is LocalServerDummy)
            {
                LocalServerDummy dummy = localServerEntity[dummyID] as LocalServerDummy;
                dummy.state              = MonsterState.dead;
                dummy.x                  = x;
                dummy.y                  = y;
                localAvatarCollectedExp += GetOneDropExpFromPool(dummy.exp);

                CliEntityManager.Instance.onActionDie(dummy, (int)MogoWorld.thePlayer.vocation);

                int spawnPointID = dummy.spawnPointID;
                if (localServerMonster.ContainsKey(spawnPointID) && localServerMonster[spawnPointID].ContainsKey(dummyID))
                {
                    if (localServerMonster[spawnPointID][dummyID] is LocalServerDummy)
                    {
                        LocalServerDummy dummyData2 = (localServerMonster[spawnPointID][dummyID] as LocalServerDummy);
                        dummyData2.state = MonsterState.dead;
                        dummyData2.x     = x;
                        dummyData2.y     = y;
                    }
                    localServerMonster[spawnPointID].Remove(dummyID);
                    CheckSpawnPointEvent(spawnPointID);
                }
            }

            localServerEntity.Remove(dummyID);
        }
        protected void WakeUpDummy(LocalServerDummy dummy, int spawnPointID)
        {
            if (dummy.state != MonsterState.sleep)
            {
                return;
            }

            dummy.state = MonsterState.active;

            List <List <int> > dummys       = new List <List <int> >();
            List <int>         dummyMessage = new List <int>();

            dummyMessage.Add((int)(EntityType.Dummy));
            dummyMessage.Add((int)dummy.ID);
            dummyMessage.Add(dummy.x);
            dummyMessage.Add(dummy.y);
            dummyMessage.Add(dummy.monsterID);
            dummyMessage.Add(0);
            dummyMessage.Add(spawnPointID);

            dummys.Add(dummyMessage);

            LuaTable args;

            Mogo.RPC.Utils.PackLuaTable(dummys, out args);

            RPCCall("CreateCliEntityResp", args);

            // 据说血量由前端读取,所以这里直接丢个0
            // MogoWorld.CreateDummy(dummy.ID, dummy.x, dummy.y, dummy.monsterID, 0);
        }
 public LocalServerDummy(LocalServerDummy template)
     : base()
 {
     spawnPointID = template.spawnPointID;
     monsterID    = template.monsterID;
     state        = template.state;
     x            = template.x;
     y            = template.y;
     exp          = template.exp;
 }
        protected void SummonToken(int spawnPointID)
        {
            if (GetCurrentAllMonsterNum() > tokenJudgeMaxNum)
            {
                return;
            }

            if (!localServerTokenTemplete.ContainsKey(spawnPointID))
            {
                return;
            }

            foreach (var monsterTemplete in localServerTokenTemplete[spawnPointID])
            {
                if (monsterTemplete is LocalServerDummy)
                {
                    LocalServerDummy summonTemplate = monsterTemplete as LocalServerDummy;
                    LocalServerDummy token          = new LocalServerDummy(summonTemplate);
                    token.ID = getNextEntityId();
                    localServerSummonToken.Add(token.ID, token);

                    List <List <int> > tokens       = new List <List <int> >();
                    List <int>         tokenMessage = new List <int>();
                    tokenMessage.Add((int)(EntityType.Dummy));
                    tokenMessage.Add((int)token.ID);
                    tokenMessage.Add(token.x);
                    tokenMessage.Add(token.y);
                    tokenMessage.Add(token.monsterID);
                    tokenMessage.Add(0);
                    tokenMessage.Add(spawnPointID);
                    LoggerHelper.Error("SummonToken:" + spawnPointID);

                    tokens.Add(tokenMessage);

                    LuaTable args;
                    Mogo.RPC.Utils.PackLuaTable(tokens, out args);

                    RPCCall("CreateCliEntityResp", args);
                }
            }
        }
Ejemplo n.º 5
0
 public void onActionDie(LocalServerDummy entity, int vocation)
 {
     onActionDie(entity.monsterID, entity.x, entity.y, vocation);
 }
Ejemplo n.º 6
0
 public void onActionDie(LocalServerDummy entity, int vocation)
 {
     onActionDie(entity.monsterID, entity.x, entity.y, vocation);
 }
        protected void ConstructMonsterData(int difficulty)
        {
            foreach (var item in LocalServerResManager.SpaceDataMap)
            {
                var spaceData = item.Value;
                if (spaceData.type != SpaceType.SpawnPoint.ToString())
                {
                    continue;
                }

                if (spaceData.levelID.Count < difficulty)
                {
                    continue;
                }

                int levelID = spaceData.levelID[difficulty - 1];
                if (!LocalServerResManager.SpawnPointLevelDataMap.ContainsKey(levelID))
                {
                    continue;
                }

                List <int> monsterIDs  = LocalServerResManager.SpawnPointLevelDataMap[levelID].monsterId;
                List <int> monsterNums = LocalServerResManager.SpawnPointLevelDataMap[levelID].monsterNumber;

                if (monsterIDs.Count != monsterNums.Count)
                {
                    continue;
                }

                if (item.Value.monsterSpawntPoint.Count % 2 != 0)
                {
                    continue;
                }

                List <KeyValuePair <int, int> > place = new List <KeyValuePair <int, int> >();
                for (int i = 0; i < item.Value.monsterSpawntPoint.Count; i += 2)
                {
                    KeyValuePair <int, int> coordinate = new KeyValuePair <int, int>(item.Value.monsterSpawntPoint[i], item.Value.monsterSpawntPoint[i + 1]);
                    place.Add(coordinate);
                }

                if (!localServerSpawnPoint.ContainsKey(item.Key))
                {
                    localServerSpawnPoint.Add(item.Key, new SpawnPoint(item.Key, item.Value.triggerType));
                }

                if (!localServerMonster.ContainsKey(item.Key))
                {
                    localServerMonster.Add(item.Key, new Dictionary <uint, LocalServerEntity>());
                }

                if (!localServerTokenTemplete.ContainsKey(item.Key))
                {
                    localServerTokenTemplete.Add(item.Key, new List <LocalServerEntity>());
                }

                int monsterCount = 0;
                for (int i = 0; i < monsterIDs.Count; i++)
                {
                    for (int j = 0; j < monsterNums[i]; j++)
                    {
                        if (monsterCount < place.Count)
                        {
                            LocalServerDummy dummy = new LocalServerDummy();
                            dummy.ID           = getNextEntityId();
                            dummy.spawnPointID = item.Key;
                            dummy.monsterID    = monsterIDs[i];
                            dummy.state        = MonsterState.sleep;
                            dummy.x            = place[monsterCount].Key;
                            dummy.y            = place[monsterCount].Value;
                            dummy.exp          = LocalServerResManager.GetMonsterData(dummy.monsterID).exp;

                            monsterCount++;

                            if (!localServerEntity.ContainsKey(dummy.ID) &&
                                !localServerMonster[item.Key].ContainsKey(dummy.ID))
                            {
                                localServerEntity.Add(dummy.ID, dummy);
                                localServerMonster[item.Key].Add(dummy.ID, dummy);
                                localServerTokenTemplete[item.Key].Add(dummy);
                            }
                            //else
                            //{
                            //    dummy.state = MonsterState.invalid;
                            //    dummy.x = 0;
                            //    dummy.x = 0;
                            //}
                        }
                        //else
                        //{
                        //}
                    }
                }
            }
        }
Ejemplo n.º 8
0
        protected void SummonToken(int spawnPointID)
        {
            if (GetCurrentAllMonsterNum() > tokenJudgeMaxNum)
                return;

            if (!localServerTokenTemplete.ContainsKey(spawnPointID))
                return;

            foreach (var monsterTemplete in localServerTokenTemplete[spawnPointID])
            {
                if (monsterTemplete is LocalServerDummy)
                {
                    LocalServerDummy summonTemplate = monsterTemplete as LocalServerDummy;
                    LocalServerDummy token = new LocalServerDummy(summonTemplate);
                    token.ID = getNextEntityId();
                    localServerSummonToken.Add(token.ID, token);

                    List<List<int>> tokens = new List<List<int>>();
                    List<int> tokenMessage = new List<int>();
                    tokenMessage.Add((int)(EntityType.Dummy));
                    tokenMessage.Add((int)token.ID);
                    tokenMessage.Add(token.x);
                    tokenMessage.Add(token.y);
                    tokenMessage.Add(token.monsterID);
                    tokenMessage.Add(0);
                    tokenMessage.Add(spawnPointID);
                    LoggerHelper.Error("SummonToken:" + spawnPointID);

                    tokens.Add(tokenMessage);

                    LuaTable args;
                    Mogo.RPC.Utils.PackLuaTable(tokens, out args);

                    RPCCall("CreateCliEntityResp", args);
                }
            }
        }
Ejemplo n.º 9
0
        protected void WakeUpDummy(LocalServerDummy dummy, int spawnPointID)
        {
            if (dummy.state != MonsterState.sleep)
                return;

            dummy.state = MonsterState.active;

            List<List<int>> dummys = new List<List<int>>();
            List<int> dummyMessage = new List<int>();
            dummyMessage.Add((int)(EntityType.Dummy));
            dummyMessage.Add((int)dummy.ID);
            dummyMessage.Add(dummy.x);
            dummyMessage.Add(dummy.y);
            dummyMessage.Add(dummy.monsterID);
            dummyMessage.Add(0);
            dummyMessage.Add(spawnPointID);

            dummys.Add(dummyMessage);

            LuaTable args;
            Mogo.RPC.Utils.PackLuaTable(dummys, out args);

            RPCCall("CreateCliEntityResp", args);

            // 据说血量由前端读取,所以这里直接丢个0
            // MogoWorld.CreateDummy(dummy.ID, dummy.x, dummy.y, dummy.monsterID, 0);
        }
Ejemplo n.º 10
0
        protected void ConstructMonsterData(int difficulty)
        {
            foreach (var item in LocalServerResManager.SpaceDataMap)
            {
                var spaceData = item.Value;
                if (spaceData.type != SpaceType.SpawnPoint.ToString())
                    continue;

                if (spaceData.levelID.Count < difficulty)
                    continue;

                int levelID = spaceData.levelID[difficulty - 1];
                if (!LocalServerResManager.SpawnPointLevelDataMap.ContainsKey(levelID))
                    continue;

                List<int> monsterIDs = LocalServerResManager.SpawnPointLevelDataMap[levelID].monsterId;
                List<int> monsterNums = LocalServerResManager.SpawnPointLevelDataMap[levelID].monsterNumber;

                if (monsterIDs.Count != monsterNums.Count)
                    continue;

                if (item.Value.monsterSpawntPoint.Count % 2 != 0)
                    continue;

                List<KeyValuePair<int, int>> place = new List<KeyValuePair<int, int>>();
                for (int i = 0; i < item.Value.monsterSpawntPoint.Count; i += 2)
                {
                    KeyValuePair<int, int> coordinate = new KeyValuePair<int, int>(item.Value.monsterSpawntPoint[i], item.Value.monsterSpawntPoint[i + 1]);
                    place.Add(coordinate);
                }

                if (!localServerSpawnPoint.ContainsKey(item.Key))
                    localServerSpawnPoint.Add(item.Key, new SpawnPoint(item.Key, item.Value.triggerType));

                if (!localServerMonster.ContainsKey(item.Key))
                    localServerMonster.Add(item.Key, new Dictionary<uint, LocalServerEntity>());

                if (!localServerTokenTemplete.ContainsKey(item.Key))
                    localServerTokenTemplete.Add(item.Key, new List<LocalServerEntity>());

                int monsterCount = 0;
                for (int i = 0; i < monsterIDs.Count; i++)
                {
                    for (int j = 0; j < monsterNums[i]; j++)
                    {
                        if (monsterCount < place.Count)
                        {
                            LocalServerDummy dummy = new LocalServerDummy();
                            dummy.ID = getNextEntityId();
                            dummy.spawnPointID = item.Key;
                            dummy.monsterID = monsterIDs[i];
                            dummy.state = MonsterState.sleep;
                            dummy.x = place[monsterCount].Key;
                            dummy.y = place[monsterCount].Value;
                            dummy.exp = LocalServerResManager.GetMonsterData(dummy.monsterID).exp;

                            monsterCount++;

                            if (!localServerEntity.ContainsKey(dummy.ID)
                                && !localServerMonster[item.Key].ContainsKey(dummy.ID))
                            {
                                localServerEntity.Add(dummy.ID, dummy);
                                localServerMonster[item.Key].Add(dummy.ID, dummy);
                                localServerTokenTemplete[item.Key].Add(dummy);
                            }
                            //else
                            //{
                            //    dummy.state = MonsterState.invalid;
                            //    dummy.x = 0;
                            //    dummy.x = 0;
                            //}
                        }
                        //else
                        //{
                        //}
                    }
                }
            }
        }
Ejemplo n.º 11
0
 public LocalServerDummy(LocalServerDummy template)
     : base()
 {
     spawnPointID = template.spawnPointID;
     monsterID = template.monsterID;
     state = template.state;
     x = template.x;
     y = template.y;
     exp = template.exp;
 }