RefreshSpells() public method

public RefreshSpells ( int player, int flag = 0x681fff, Player observer = null ) : void
player int
flag int
observer Player
return void
Exemplo n.º 1
0
        private void OnTagSwap(CoreMessage msg)
        {
            GamePacketWriter packet = GamePacketFactory.Create(GameMessage.TagSwap);

            int player = msg.Reader.ReadByte();

            packet.Write((byte)player);

            packet.Write(msg.Reader.ReadByte()); // mcount
            int ecount = msg.Reader.ReadByte();

            packet.Write((byte)ecount);
            packet.Write(msg.Reader.ReadByte()); // pcount
            int hcount = msg.Reader.ReadByte();

            packet.Write((byte)hcount);

            packet.Write(msg.Reader.ReadBytes(4)); // topcode

            for (int i = 0; i < hcount + ecount; i++)
            {
                uint code = msg.Reader.ReadUInt32();
                if ((code & 0x80000000) != 0)
                {
                    packet.Write(code);
                }
                else
                {
                    packet.Write(0);
                }
            }

            SendToPlayer(msg, player);
            Game.SendToAllBut(packet, player);

            Game.RefreshExtra(player);
            Game.RefreshMonsters(0, 0x81fff);
            Game.RefreshMonsters(1, 0x81fff);
            Game.RefreshSpells(0, 0x681fff);
            Game.RefreshSpells(1, 0x681fff);
            Game.RefreshHand(0, 0x181fff);
            Game.RefreshHand(1, 0x181fff);
        }
Exemplo n.º 2
0
        private void OnTagSwap(CoreMessage msg)
        {
            GameServerPacket packet = new GameServerPacket(GameMessage.TagSwap);

            int player = msg.Reader.ReadByte();

            packet.Write((byte)player);
            packet.Write(msg.Reader.ReadBytes(2));
            int count = msg.Reader.ReadByte();

            packet.Write((byte)count);
            packet.Write(msg.Reader.ReadBytes(4));

            for (int i = 0; i < count; i++)
            {
                uint code = msg.Reader.ReadUInt32();
                if ((code & 0x80000000) != 0)
                {
                    packet.Write(code);
                }
                else
                {
                    packet.Write(0);
                }
            }

            SendToPlayer(msg, player);
            Game.SendToAllBut(packet, player);

            Game.RefreshExtra(player);
            Game.RefreshMonsters(0, 0x81fff, false);
            Game.RefreshMonsters(1, 0x81fff, false);
            Game.RefreshSpells(0, 0x681fff, false);
            Game.RefreshSpells(1, 0x681fff, false);
            Game.RefreshHand(0, 0x181fff, false);
            Game.RefreshHand(1, 0x181fff, false);
        }
Exemplo n.º 3
0
        public int Analyse(GameMessage msg, BinaryReader reader, byte[] raw)
        {
            LastMessage = msg;
            CoreMessage cmsg = new CoreMessage(msg, reader, raw);

            switch (msg)
            {
            case GameMessage.Retry:
                OnRetry();
                return(1);

            case GameMessage.Hint:
                OnHint(cmsg);
                break;

            case GameMessage.Win:
                OnWin(cmsg);
                return(2);

            case GameMessage.SelectBattleCmd:
                OnSelectBattleCmd(cmsg);
                return(1);

            case GameMessage.SelectIdleCmd:
                OnSelectIdleCmd(cmsg);
                return(1);

            case GameMessage.SelectEffectYn:
                OnSelectEffectYn(cmsg);
                return(1);

            case GameMessage.SelectYesNo:
                OnSelectYesNo(cmsg);
                return(1);

            case GameMessage.SelectOption:
                OnSelectOption(cmsg);
                return(1);

            case GameMessage.SelectCard:
            case GameMessage.SelectTribute:
                OnSelectCard(cmsg);
                return(1);

            case GameMessage.SelectChain:
                return(OnSelectChain(cmsg));

            case GameMessage.SelectPlace:
            case GameMessage.SelectDisfield:
            case GameMessage.SelectPosition:
                OnSelectPlace(cmsg);
                return(1);

            case GameMessage.SelectCounter:
                OnSelectCounter(cmsg);
                return(1);

            case GameMessage.SelectSum:
                OnSelectSum(cmsg);
                return(1);

            case GameMessage.SortCard:
            case GameMessage.SortChain:
                OnSortCard(cmsg);
                return(1);

            case GameMessage.ConfirmDecktop:
                OnConfirmDecktop(cmsg);
                break;

            case GameMessage.ConfirmCards:
                OnConfirmCards(cmsg);
                break;

            case GameMessage.ShuffleDeck:
            case GameMessage.RefreshDeck:
                SendToAll(cmsg, 1);
                break;

            case GameMessage.ShuffleHand:
                OnShuffleHand(cmsg);
                break;

            case GameMessage.SwapGraveDeck:
                OnSwapGraveDeck(cmsg);
                break;

            case GameMessage.ReverseDeck:
                SendToAll(cmsg, 0);
                break;

            case GameMessage.DeckTop:
                SendToAll(cmsg, 6);
                break;

            case GameMessage.ShuffleSetCard:
                OnShuffleSetCard(cmsg);
                break;

            case GameMessage.NewTurn:
                OnNewTurn(cmsg);
                break;

            case GameMessage.NewPhase:
                OnNewPhase(cmsg);
                break;

            case GameMessage.Move:
                OnMove(cmsg);
                break;

            case GameMessage.PosChange:
                OnPosChange(cmsg);
                break;

            case GameMessage.Set:
                OnSet(cmsg);
                break;

            case GameMessage.Swap:
                SendToAll(cmsg, 16);
                break;

            case GameMessage.FieldDisabled:
                SendToAll(cmsg, 4);
                break;

            case GameMessage.Summoned:
            case GameMessage.SpSummoned:
            case GameMessage.FlipSummoned:
                SendToAll(cmsg, 0);
                Game.RefreshMonsters(0);
                Game.RefreshMonsters(1);
                Game.RefreshSpells(0);
                Game.RefreshSpells(1);
                break;

            case GameMessage.Summoning:
            case GameMessage.SpSummoning:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.FlipSummoning:
                OnFlipSummoning(cmsg);
                break;

            case GameMessage.Chaining:
                SendToAll(cmsg, 16);
                break;

            case GameMessage.Chained:
                SendToAll(cmsg, 1);
                Game.RefreshAll();
                break;

            case GameMessage.ChainSolving:
                SendToAll(cmsg, 1);
                break;

            case GameMessage.ChainSolved:
                SendToAll(cmsg, 1);
                Game.RefreshAll();
                break;

            case GameMessage.ChainEnd:
                SendToAll(cmsg, 0);
                Game.RefreshAll();
                break;

            case GameMessage.ChainNegated:
            case GameMessage.ChainDisabled:
                SendToAll(cmsg, 1);
                break;

            case GameMessage.CardSelected:
                OnCardSelected(cmsg);
                break;

            case GameMessage.RandomSelected:
                OnRandomSelected(cmsg);
                break;

            case GameMessage.BecomeTarget:
                OnBecomeTarget(cmsg);
                break;

            case GameMessage.Draw:
                OnDraw(cmsg);
                break;

            case GameMessage.Damage:
            case GameMessage.Recover:
            case GameMessage.LpUpdate:
            case GameMessage.PayLpCost:
                OnLpUpdate(cmsg);
                break;

            case GameMessage.Equip:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.Unequip:
                SendToAll(cmsg, 4);
                break;

            case GameMessage.CardTarget:
            case GameMessage.CancelTarget:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.AddCounter:
            case GameMessage.RemoveCounter:
                SendToAll(cmsg, 7);
                break;

            case GameMessage.Attack:
                SendToAll(cmsg, 8);
                break;

            case GameMessage.Battle:
                SendToAll(cmsg, 26);
                break;

            case GameMessage.AttackDiabled:
                SendToAll(cmsg, 0);
                break;

            case GameMessage.DamageStepStart:
            case GameMessage.DamageStepEnd:
                SendToAll(cmsg, 0);
                Game.RefreshMonsters(0);
                Game.RefreshMonsters(1);
                break;

            case GameMessage.MissedEffect:
                OnMissedEffect(cmsg);
                break;

            case GameMessage.TossCoin:
            case GameMessage.TossDice:
                OnTossCoin(cmsg);
                break;

            case GameMessage.AnnounceRace:
                OnAnnounceRace(cmsg);
                return(1);

            case GameMessage.AnnounceAttrib:
                OnAnnounceAttrib(cmsg);
                return(1);

            case GameMessage.AnnounceCard:
                OnAnnounceCard(cmsg);
                return(1);

            case GameMessage.AnnounceNumber:
                OnAnnounceNumber(cmsg);
                return(1);

            case GameMessage.CardHint:
                SendToAll(cmsg, 9);
                break;

            case GameMessage.MatchKill:
                OnMatchKill(cmsg);
                break;

            case GameMessage.TagSwap:
                OnTagSwap(cmsg);
                break;

            default:
                throw new Exception("[GameAnalyser] Unhandled packet id: " + msg);
            }
            return(0);
        }