Example #1
0
        public void SetKingSpell(byte worldId, int playerId)
        {
            Entry entry = World.Instance(worldId).GameMode.GetEntry(playerId);

            if (entry == null)
            {
                LogHelper.LogError($"Can't find entry in SetKingSpell playerId : {playerId}");
                return;
            }

            NetGameObject netGameObject = NetworkManager.Instance.GetGameObject(entry.mNetworkId, worldId);

            if (netGameObject == null || !(netGameObject is SActor))
            {
                LogHelper.LogError($"netGameObject == null or netGameObject is not SActor playerId : {playerId}, worldId : {worldId}");
                return;
            }

            SActor actor    = netGameObject as SActor;
            var    modeData = ACDC.GameModeData[(int)GetMode()];

            for (int i = 0; i < modeData.ModeSpellIDs.Length; ++i)
            {
                actor.AddSpell(ACDC.SpellData[modeData.ModeSpellIDs[i]], 0);
            }

            if (actor.StateServerSide != ActorState.Ghost)
            {
                actor.ResetHealth(actor.GetCharacterHp(), null);
            }
        }