示例#1
0
        internal string ConvertPStruct(PStruct struct_)
        {
            string result = "DataKeepStruct(";

            result += '"' + struct_.name + "\", [";

            for (int i = 0; i < struct_.tags.Length; i++)
            {
                result += ConvertPTag(ref struct_.tags[i]);
                if (i != struct_.tags.Length - 1)
                {
                    result += ",";
                }
            }
            result += "], [";

            for (int i = 0; i < struct_.fields.Length; i++)
            {
                result += ConvertPField(ref struct_.fields[i]);
                if (i != struct_.fields.Length - 1)
                {
                    result += ",";
                }
            }

            return(result + "])");
        }
示例#2
0
        public void GiveStructInheritance()
        {
            ArrayList newStructs = new ArrayList();

            DebugDK.Log("Giving each struct its inheritant fields.");

            DebugDK.Log("Looping to all the structs.");
            for (int i = 0; i < structs.Count; i++)
            {
                PStruct currentStruct = (PStruct)structs[i];

                DebugDK.Log("Checking if this struct has inheritance..., struct is : " + currentStruct.name + " |" + i);
                if (currentStruct.inheritance != "")
                {
                    DebugDK.Log("Current struct has inheritance : " + currentStruct.inheritance);
                    DebugDK.Log("Looping through all the structs to find a match...");

                    // NOTE: change removebeginwhitespace function at the inheritance detection if problems with finding.
                    foreach (PStruct pStruct in structs)
                    {
                        DebugDK.Log("     Looking for match with struct " + pStruct.name);
                        if (pStruct.name == currentStruct.inheritance)
                        {
                            DebugDK.Log("     Match found. Adding fields.");
                            ArrayList newField = new ArrayList();

                            foreach (PField p in pStruct.fields)
                            {
                                newField.Add(p);
                            }
                            foreach (PField p in currentStruct.fields)
                            {
                                newField.Add(p);
                            }

                            currentStruct.fields = (PField[])newField.ToArray(typeof(PField));
                        }
                    }
                }

                newStructs.Add(currentStruct);
            }

            structs = newStructs;


            DebugDK.Log("Struct inheritance is done.");
        }
示例#3
0
        public void PrintAllData()
        {
            if (DebugDK.log)
            {
                DebugDK.Log("\nWriting out all of the resulting parser data (PStructs) : ");

                foreach (PStruct ps in structs)
                {
                    DebugDK.Log(PStruct.ToString(ps));
                }

                DebugDK.Log("Definitions : ");
                foreach (DictionaryEntry e in defs)
                {
                    DebugDK.Log(e.Key + " : " + defs[e.Key]);
                }
                DebugDK.Log("Flags : ");
                foreach (DictionaryEntry e in flags)
                {
                    DebugDK.Log(e.Key + " : " + flags[e.Key]);
                }
            }
        }
示例#4
0
        //*********************************************************************************************
        // DisconnectUser / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon
        // Desconectar o jogador.
        //*********************************************************************************************
        public static void DisconnectUser(int clientid)
        {
            //EXTEND
            if (Extensions.ExtensionApp.ExtendMyApp
                    (MethodBase.GetCurrentMethod().Name, clientid) != null)
            {
                return;
            }

            //CÓDIGO
            //LOL
            if ((Clients.Count <= 0) || (clientid > Clients.Count - 1))
            {
                return;
            }
            //Se estiver morto, resetar posição
            //PStruct.tempplayer[Clients[clientid].index].isDead = false;

            //Sai da troca
            if (PStruct.tempplayer[Clients[clientid].index].InTrade > 0)
            {
                TradeRelations.GiveTrade(Clients[clientid].index);
                TradeRelations.GiveTrade(PStruct.tempplayer[Clients[clientid].index].InTrade);

                //Verificar se o jogador não se desconectou no processo
                if (Clients[(UserConnection.Getindex(PStruct.tempplayer[Clients[clientid].index].InTrade))].IsConnected)
                {
                    SendData.Send_PlayerG(PStruct.tempplayer[Clients[clientid].index].InTrade);
                    SendData.Send_TradeClose(PStruct.tempplayer[Clients[clientid].index].InTrade);
                    SendData.Send_InvSlots(PStruct.tempplayer[Clients[clientid].index].InTrade, PStruct.player[PStruct.tempplayer[Clients[clientid].index].InTrade].SelectedChar);
                }

                TradeRelations.ClearTempTrade(PStruct.tempplayer[Clients[clientid].index].InTrade);
                TradeRelations.ClearTempTrade(Clients[clientid].index);
            }

            //Sai do Craft
            if (PStruct.tempplayer[Clients[clientid].index].InCraft)
            {
                for (int i = 1; i < Globals.Max_Craft; i++)
                {
                    if (PStruct.craft[Clients[clientid].index, i].num > 0)
                    {
                        InventoryRelations.GiveItem(Clients[clientid].index, PStruct.craft[Clients[clientid].index, i].type, PStruct.craft[Clients[clientid].index, i].num, PStruct.craft[Clients[clientid].index, i].value, PStruct.craft[Clients[clientid].index, i].refin, PStruct.craft[Clients[clientid].index, i].exp);
                    }
                }
            }

            //Salva o jogador SE PRECISAR
            if (PStruct.tempplayer[Clients[clientid].index].ingame)
            {
                Database.SaveCharacter(Clients[clientid].index, PStruct.player[Clients[clientid].index].Email, PStruct.player[Clients[clientid].index].SelectedChar);
                Database.SaveBank(Clients[clientid].index);
                Database.SaveFriendList(Clients[clientid].index);
            }

            //Sai do grupo
            if (PStruct.tempplayer[Clients[clientid].index].Party > 0)
            {
                PartyRelations.KickParty(Clients[clientid].index, Clients[clientid].index, true);
            }

            //Vamos avisar ao mapa que o jogador saiu
            SendData.Send_PlayerLeft(PStruct.character[Clients[clientid].index, PStruct.player[Clients[clientid].index].SelectedChar].Map, Clients[clientid].index);

            //Apagamos o banco
            Database.ClearBank(Clients[clientid].index);

            Console.WriteLine(lang.player_cleared + " " + clientid + Clients[clientid].index);

            //Fecha a conexão
            Clients[clientid].Async.Close();

            //Limpa dados sobre o jogador
            Clients[clientid].Async = null;

            //Limpa dados temporários sobre o jogador
            Database.ClearPlayer(Clients[clientid].index, true);
            PStruct.ClearTempPlayer(Clients[clientid].index);

            //Limpa informações gerais da conexão
            Clients[clientid].index = -1;

            //Remova da lista de clientes do servidor
            Clients.RemoveAt(clientid);

            //Zerar o Player_Highindex pra evitar problemas
            Globals.Player_Highindex = 0;

            //Vamos atualizar o Player_Highindex sem frescura
            for (int i = 0; i < WinsockAsync.Clients.Count(); i++)
            {
                if (Clients[i].index > Globals.Player_Highindex)
                {
                    Globals.Player_Highindex = Clients[i].index;
                }
            }

            //Vamos atualizar o Player_Highindex para todos os jogadores
            SendData.Send_UpdatePlayerHighindex();

            Log(lang.player_disconnected + " " + clientid);
        }
示例#5
0
        static void Main(string[] args)
        {
            //PStruct.InitializePlayerArrays();
            //Database.ResetAndGiveExp();

            Log("Iniciando servidor...");
            Log("Cliente definido...");
            Log("");
            Log("Inicializando Array's dos jogadores...");
            PStruct.InitializePlayerArrays();
            Log("Inicializando Array's das guildas...");
            GStruct.InitializeGuildArrays();
            Log("Array's inicializadas.");
            Log("");
            Log("Carregando Inimigos...");
            Database.LoadEnemies();
            Log("Carregado.");
            Log("Carregando Mapas, Missões e Monstros...");
            Database.LoadMaps();
            Log("Carregado.");
            Log("Carregando Itens...");
            Database.LoadItems();
            Log("Carregado.");
            Log("Carregando Armas...");
            Database.LoadWeapons();
            Log("Carregado.");
            Log("Carregando Armaduras...");
            Database.LoadArmors();
            Log("Carregado.");
            Log("Carregando Habilidades...");
            Database.LoadSkills();
            Log("Carregado.");
            Log("Carregando Lojas...");
            Database.LoadShops();
            //Manual, no editor, sorry :/
            ShopStruct.shop[1].map        = 3;
            ShopStruct.shop[1].x          = 9;
            ShopStruct.shop[1].y          = 7;
            ShopStruct.shop[1].item_count = 2;

            ShopStruct.shopitem[1, 1].type  = 1;
            ShopStruct.shopitem[1, 1].num   = 1;
            ShopStruct.shopitem[1, 1].value = 1;
            ShopStruct.shopitem[1, 1].refin = 0;
            ShopStruct.shopitem[1, 1].price = 75;

            ShopStruct.shopitem[1, 2].type  = 1;
            ShopStruct.shopitem[1, 2].num   = 2;
            ShopStruct.shopitem[1, 2].value = 1;
            ShopStruct.shopitem[1, 2].refin = 0;
            ShopStruct.shopitem[1, 2].price = 75;

            //Manual, no editor, sorry :/
            ShopStruct.shop[2].map        = 132;
            ShopStruct.shop[2].x          = 13;
            ShopStruct.shop[2].y          = 7;
            ShopStruct.shop[2].item_count = 1;

            ShopStruct.shopitem[2, 1].type  = 1;
            ShopStruct.shopitem[2, 1].num   = 50;
            ShopStruct.shopitem[2, 1].value = 1;
            ShopStruct.shopitem[2, 1].refin = 0;
            ShopStruct.shopitem[2, 1].price = 25;

            //Manual, no editor, sorry :/
            ShopStruct.shop[3].map        = 136;
            ShopStruct.shop[3].x          = 12;
            ShopStruct.shop[3].y          = 10;
            ShopStruct.shop[3].item_count = 1;

            ShopStruct.shopitem[3, 1].type  = 2;
            ShopStruct.shopitem[3, 1].num   = 28;
            ShopStruct.shopitem[3, 1].value = 1;
            ShopStruct.shopitem[3, 1].refin = 0;
            ShopStruct.shopitem[3, 1].price = 1;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[4].map        = 77;
            ShopStruct.shop[4].x          = 13;
            ShopStruct.shop[4].y          = 3;
            ShopStruct.shop[4].item_count = 1;

            ShopStruct.shopitem[4, 1].type  = 1;
            ShopStruct.shopitem[4, 1].num   = 5;
            ShopStruct.shopitem[4, 1].value = 1;
            ShopStruct.shopitem[4, 1].refin = 0;
            ShopStruct.shopitem[4, 1].price = 100;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[5].map        = 148;
            ShopStruct.shop[5].x          = 9;
            ShopStruct.shop[5].y          = 7;
            ShopStruct.shop[5].item_count = 1;

            ShopStruct.shopitem[5, 1].type  = 2;
            ShopStruct.shopitem[5, 1].num   = 31;
            ShopStruct.shopitem[5, 1].value = 1;
            ShopStruct.shopitem[5, 1].refin = 0;
            ShopStruct.shopitem[5, 1].price = 1;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[6].map        = 149;
            ShopStruct.shop[6].x          = 10;
            ShopStruct.shop[6].y          = 6;
            ShopStruct.shop[6].item_count = 1;

            ShopStruct.shopitem[6, 1].type  = 1;
            ShopStruct.shopitem[6, 1].num   = 47;
            ShopStruct.shopitem[6, 1].value = 1;
            ShopStruct.shopitem[6, 1].refin = 0;
            ShopStruct.shopitem[6, 1].price = 50;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[7].map        = 0;
            ShopStruct.shop[7].x          = 0;
            ShopStruct.shop[7].y          = 0;
            ShopStruct.shop[7].item_count = 3;

            ShopStruct.shopitem[7, 1].type  = 1;
            ShopStruct.shopitem[7, 1].num   = 68;
            ShopStruct.shopitem[7, 1].value = 1;
            ShopStruct.shopitem[7, 1].refin = 0;
            ShopStruct.shopitem[7, 1].price = 5;// 225;

            ShopStruct.shopitem[7, 2].type  = 1;
            ShopStruct.shopitem[7, 2].num   = 70;
            ShopStruct.shopitem[7, 2].value = 1;
            ShopStruct.shopitem[7, 2].refin = 0;
            ShopStruct.shopitem[7, 2].price = 10;// 225;

            ShopStruct.shopitem[7, 3].type  = 1;
            ShopStruct.shopitem[7, 3].num   = 71;
            ShopStruct.shopitem[7, 3].value = 1;
            ShopStruct.shopitem[7, 3].refin = 0;
            ShopStruct.shopitem[7, 3].price = 10;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[8].map        = 13;
            ShopStruct.shop[8].x          = 5;
            ShopStruct.shop[8].y          = 7;
            ShopStruct.shop[8].item_count = 1;

            ShopStruct.shopitem[8, 1].type  = 1;
            ShopStruct.shopitem[8, 1].num   = 69;
            ShopStruct.shopitem[8, 1].value = 1;
            ShopStruct.shopitem[8, 1].refin = 0;
            ShopStruct.shopitem[8, 1].price = 500;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[9].map        = 167;
            ShopStruct.shop[9].x          = 11;
            ShopStruct.shop[9].y          = 6;
            ShopStruct.shop[9].item_count = 11;

            ShopStruct.shopitem[9, 1].type  = 2;
            ShopStruct.shopitem[9, 1].num   = 2;
            ShopStruct.shopitem[9, 1].value = 1;
            ShopStruct.shopitem[9, 1].refin = 0;
            ShopStruct.shopitem[9, 1].price = 209;// 225;

            ShopStruct.shopitem[9, 2].type  = 2;
            ShopStruct.shopitem[9, 2].num   = 3;
            ShopStruct.shopitem[9, 2].value = 1;
            ShopStruct.shopitem[9, 2].refin = 0;
            ShopStruct.shopitem[9, 2].price = 477;// 225;

            ShopStruct.shopitem[9, 3].type  = 2;
            ShopStruct.shopitem[9, 3].num   = 4;
            ShopStruct.shopitem[9, 3].value = 1;
            ShopStruct.shopitem[9, 3].refin = 0;
            ShopStruct.shopitem[9, 3].price = 990;// 225;

            ShopStruct.shopitem[9, 4].type  = 2;
            ShopStruct.shopitem[9, 4].num   = 5;
            ShopStruct.shopitem[9, 4].value = 1;
            ShopStruct.shopitem[9, 4].refin = 0;
            ShopStruct.shopitem[9, 4].price = 1650;// 225;

            ShopStruct.shopitem[9, 5].type  = 2;
            ShopStruct.shopitem[9, 5].num   = 6;
            ShopStruct.shopitem[9, 5].value = 1;
            ShopStruct.shopitem[9, 5].refin = 0;
            ShopStruct.shopitem[9, 5].price = 3350;// 225;

            ShopStruct.shopitem[9, 6].type  = 2;
            ShopStruct.shopitem[9, 6].num   = 7;
            ShopStruct.shopitem[9, 6].value = 1;
            ShopStruct.shopitem[9, 6].refin = 0;
            ShopStruct.shopitem[9, 6].price = 5450;// 225;

            ShopStruct.shopitem[9, 7].type  = 2;
            ShopStruct.shopitem[9, 7].num   = 8;
            ShopStruct.shopitem[9, 7].value = 1;
            ShopStruct.shopitem[9, 7].refin = 0;
            ShopStruct.shopitem[9, 7].price = 8220;// 225;

            ShopStruct.shopitem[9, 8].type  = 2;
            ShopStruct.shopitem[9, 8].num   = 8;
            ShopStruct.shopitem[9, 8].value = 1;
            ShopStruct.shopitem[9, 8].refin = 0;
            ShopStruct.shopitem[9, 8].price = 10130;// 225;

            ShopStruct.shopitem[9, 9].type  = 2;
            ShopStruct.shopitem[9, 9].num   = 9;
            ShopStruct.shopitem[9, 9].value = 1;
            ShopStruct.shopitem[9, 9].refin = 0;
            ShopStruct.shopitem[9, 9].price = 13630;// 225;

            ShopStruct.shopitem[9, 10].type  = 2;
            ShopStruct.shopitem[9, 10].num   = 10;
            ShopStruct.shopitem[9, 10].value = 1;
            ShopStruct.shopitem[9, 10].refin = 0;
            ShopStruct.shopitem[9, 10].price = 17780;// 225;

            ShopStruct.shopitem[9, 11].type  = 2;
            ShopStruct.shopitem[9, 11].num   = 11;
            ShopStruct.shopitem[9, 11].value = 1;
            ShopStruct.shopitem[9, 11].refin = 0;
            ShopStruct.shopitem[9, 11].price = 23180;// 225;


            //Manual, no editor, sorry :/
            ShopStruct.shop[10].map        = 168;
            ShopStruct.shop[10].x          = 11;
            ShopStruct.shop[10].y          = 6;
            ShopStruct.shop[10].item_count = 12;

            ShopStruct.shopitem[10, 1].type  = 3;
            ShopStruct.shopitem[10, 1].num   = 2;
            ShopStruct.shopitem[10, 1].value = 1;
            ShopStruct.shopitem[10, 1].refin = 0;
            ShopStruct.shopitem[10, 1].price = 189;// 225;

            ShopStruct.shopitem[10, 2].type  = 3;
            ShopStruct.shopitem[10, 2].num   = 3;
            ShopStruct.shopitem[10, 2].value = 1;
            ShopStruct.shopitem[10, 2].refin = 0;
            ShopStruct.shopitem[10, 2].price = 389;// 225;

            ShopStruct.shopitem[10, 3].type  = 3;
            ShopStruct.shopitem[10, 3].num   = 4;
            ShopStruct.shopitem[10, 3].value = 1;
            ShopStruct.shopitem[10, 3].refin = 0;
            ShopStruct.shopitem[10, 3].price = 756;// 225;

            ShopStruct.shopitem[10, 4].type  = 3;
            ShopStruct.shopitem[10, 4].num   = 5;
            ShopStruct.shopitem[10, 4].value = 1;
            ShopStruct.shopitem[10, 4].refin = 0;
            ShopStruct.shopitem[10, 4].price = 1229;// 225;

            ShopStruct.shopitem[10, 5].type  = 3;
            ShopStruct.shopitem[10, 5].num   = 14;
            ShopStruct.shopitem[10, 5].value = 1;
            ShopStruct.shopitem[10, 5].refin = 0;
            ShopStruct.shopitem[10, 5].price = 4663;// 225;

            ShopStruct.shopitem[10, 6].type  = 3;
            ShopStruct.shopitem[10, 6].num   = 15;
            ShopStruct.shopitem[10, 6].value = 1;
            ShopStruct.shopitem[10, 6].refin = 0;
            ShopStruct.shopitem[10, 6].price = 7224;// 225;

            ShopStruct.shopitem[10, 7].type  = 3;
            ShopStruct.shopitem[10, 7].num   = 16;
            ShopStruct.shopitem[10, 7].value = 1;
            ShopStruct.shopitem[10, 7].refin = 0;
            ShopStruct.shopitem[10, 7].price = 10101;// 225;

            ShopStruct.shopitem[10, 8].type  = 3;
            ShopStruct.shopitem[10, 8].num   = 17;
            ShopStruct.shopitem[10, 8].value = 1;
            ShopStruct.shopitem[10, 8].refin = 0;
            ShopStruct.shopitem[10, 8].price = 14101;// 225;

            ShopStruct.shopitem[10, 9].type  = 3;
            ShopStruct.shopitem[10, 9].num   = 18;
            ShopStruct.shopitem[10, 9].value = 1;
            ShopStruct.shopitem[10, 9].refin = 0;
            ShopStruct.shopitem[10, 9].price = 19243;// 225;

            ShopStruct.shopitem[10, 10].type  = 3;
            ShopStruct.shopitem[10, 10].num   = 22;
            ShopStruct.shopitem[10, 10].value = 1;
            ShopStruct.shopitem[10, 10].refin = 0;
            ShopStruct.shopitem[10, 10].price = 22342;// 225;

            ShopStruct.shopitem[10, 11].type  = 3;
            ShopStruct.shopitem[10, 11].num   = 23;
            ShopStruct.shopitem[10, 11].value = 1;
            ShopStruct.shopitem[10, 11].refin = 0;
            ShopStruct.shopitem[10, 11].price = 26347;// 225;

            ShopStruct.shopitem[10, 12].type  = 3;
            ShopStruct.shopitem[10, 12].num   = 24;
            ShopStruct.shopitem[10, 12].value = 1;
            ShopStruct.shopitem[10, 12].refin = 0;
            ShopStruct.shopitem[10, 12].price = 32345;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[11].map        = 174;
            ShopStruct.shop[11].x          = 11;
            ShopStruct.shop[11].y          = 6;
            ShopStruct.shop[11].item_count = 6;

            ShopStruct.shopitem[11, 1].type  = 2;
            ShopStruct.shopitem[11, 1].num   = 34;
            ShopStruct.shopitem[11, 1].value = 1;
            ShopStruct.shopitem[11, 1].refin = 0;
            ShopStruct.shopitem[11, 1].price = 500;// 225;

            ShopStruct.shopitem[11, 2].type  = 2;
            ShopStruct.shopitem[11, 2].num   = 32;
            ShopStruct.shopitem[11, 2].value = 1;
            ShopStruct.shopitem[11, 2].refin = 0;
            ShopStruct.shopitem[11, 2].price = 1200;// 225;

            ShopStruct.shopitem[11, 3].type  = 2;
            ShopStruct.shopitem[11, 3].num   = 33;
            ShopStruct.shopitem[11, 3].value = 1;
            ShopStruct.shopitem[11, 3].refin = 0;
            ShopStruct.shopitem[11, 3].price = 2100;// 225;

            ShopStruct.shopitem[11, 4].type  = 2;
            ShopStruct.shopitem[11, 4].num   = 35;
            ShopStruct.shopitem[11, 4].value = 1;
            ShopStruct.shopitem[11, 4].refin = 0;
            ShopStruct.shopitem[11, 4].price = 5000;// 225;

            ShopStruct.shopitem[11, 5].type  = 2;
            ShopStruct.shopitem[11, 5].num   = 36;
            ShopStruct.shopitem[11, 5].value = 1;
            ShopStruct.shopitem[11, 5].refin = 0;
            ShopStruct.shopitem[11, 5].price = 8000;// 225;

            ShopStruct.shopitem[11, 6].type  = 2;
            ShopStruct.shopitem[11, 6].num   = 37;
            ShopStruct.shopitem[11, 6].value = 1;
            ShopStruct.shopitem[11, 6].refin = 0;
            ShopStruct.shopitem[11, 6].price = 14000; //225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[12].map        = 175;
            ShopStruct.shop[12].x          = 11;
            ShopStruct.shop[12].y          = 6;
            ShopStruct.shop[12].item_count = 11;

            ShopStruct.shopitem[12, 1].type  = 3;
            ShopStruct.shopitem[12, 1].num   = 7;
            ShopStruct.shopitem[12, 1].value = 1;
            ShopStruct.shopitem[12, 1].refin = 0;
            ShopStruct.shopitem[12, 1].price = 300;// 225;

            ShopStruct.shopitem[12, 2].type  = 3;
            ShopStruct.shopitem[12, 2].num   = 8;
            ShopStruct.shopitem[12, 2].value = 1;
            ShopStruct.shopitem[12, 2].refin = 0;
            ShopStruct.shopitem[12, 2].price = 600;// 225;

            ShopStruct.shopitem[12, 3].type  = 3;
            ShopStruct.shopitem[12, 3].num   = 9;
            ShopStruct.shopitem[12, 3].value = 1;
            ShopStruct.shopitem[12, 3].refin = 0;
            ShopStruct.shopitem[12, 3].price = 1100;// 225;

            ShopStruct.shopitem[12, 4].type  = 3;
            ShopStruct.shopitem[12, 4].num   = 10;
            ShopStruct.shopitem[12, 4].value = 1;
            ShopStruct.shopitem[12, 4].refin = 0;
            ShopStruct.shopitem[12, 4].price = 1800;// 225;

            ShopStruct.shopitem[12, 5].type  = 3;
            ShopStruct.shopitem[12, 5].num   = 11;
            ShopStruct.shopitem[12, 5].value = 1;
            ShopStruct.shopitem[12, 5].refin = 0;
            ShopStruct.shopitem[12, 5].price = 2500;// 225;

            ShopStruct.shopitem[12, 6].type  = 3;
            ShopStruct.shopitem[12, 6].num   = 12;
            ShopStruct.shopitem[12, 6].value = 1;
            ShopStruct.shopitem[12, 6].refin = 0;
            ShopStruct.shopitem[12, 6].price = 4000;// 225;

            ShopStruct.shopitem[12, 7].type  = 3;
            ShopStruct.shopitem[12, 7].num   = 13;
            ShopStruct.shopitem[12, 7].value = 1;
            ShopStruct.shopitem[12, 7].refin = 0;
            ShopStruct.shopitem[12, 7].price = 6200;// 225;

            ShopStruct.shopitem[12, 8].type  = 3;
            ShopStruct.shopitem[12, 8].num   = 25;
            ShopStruct.shopitem[12, 8].value = 1;
            ShopStruct.shopitem[12, 8].refin = 0;
            ShopStruct.shopitem[12, 8].price = 9300;// 225;

            ShopStruct.shopitem[12, 9].type  = 3;
            ShopStruct.shopitem[12, 9].num   = 26;
            ShopStruct.shopitem[12, 9].value = 1;
            ShopStruct.shopitem[12, 9].refin = 0;
            ShopStruct.shopitem[12, 9].price = 13800;// 225;

            ShopStruct.shopitem[12, 10].type  = 3;
            ShopStruct.shopitem[12, 10].num   = 27;
            ShopStruct.shopitem[12, 10].value = 1;
            ShopStruct.shopitem[12, 10].refin = 0;
            ShopStruct.shopitem[12, 10].price = 17100;// 225;

            ShopStruct.shopitem[12, 11].type  = 3;
            ShopStruct.shopitem[12, 11].num   = 30;
            ShopStruct.shopitem[12, 11].value = 1;
            ShopStruct.shopitem[12, 11].refin = 0;
            ShopStruct.shopitem[12, 11].price = 22400;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[13].map        = 170;
            ShopStruct.shop[13].x          = 11;
            ShopStruct.shop[13].y          = 6;
            ShopStruct.shop[13].item_count = 7;

            ShopStruct.shopitem[13, 1].type  = 1;
            ShopStruct.shopitem[13, 1].num   = 1;
            ShopStruct.shopitem[13, 1].value = 1;
            ShopStruct.shopitem[13, 1].refin = 0;
            ShopStruct.shopitem[13, 1].price = 75;// 225;

            ShopStruct.shopitem[13, 2].type  = 1;
            ShopStruct.shopitem[13, 2].num   = 2;
            ShopStruct.shopitem[13, 2].value = 1;
            ShopStruct.shopitem[13, 2].refin = 0;
            ShopStruct.shopitem[13, 2].price = 75;// 225;

            ShopStruct.shopitem[13, 3].type  = 1;
            ShopStruct.shopitem[13, 3].num   = 69;
            ShopStruct.shopitem[13, 3].value = 1;
            ShopStruct.shopitem[13, 3].refin = 0;
            ShopStruct.shopitem[13, 3].price = 500;// 225;

            ShopStruct.shopitem[13, 4].type  = 1;
            ShopStruct.shopitem[13, 4].num   = 73;
            ShopStruct.shopitem[13, 4].value = 1;
            ShopStruct.shopitem[13, 4].refin = 0;
            ShopStruct.shopitem[13, 4].price = 200;// 225;

            ShopStruct.shopitem[13, 5].type  = 1;
            ShopStruct.shopitem[13, 5].num   = 72;
            ShopStruct.shopitem[13, 5].value = 1;
            ShopStruct.shopitem[13, 5].refin = 0;
            ShopStruct.shopitem[13, 5].price = 700;// 225;

            ShopStruct.shopitem[13, 6].type  = 1;
            ShopStruct.shopitem[13, 6].num   = 74;
            ShopStruct.shopitem[13, 6].value = 1;
            ShopStruct.shopitem[13, 6].refin = 0;
            ShopStruct.shopitem[13, 6].price = 500;// 225;

            ShopStruct.shopitem[13, 7].type  = 1;
            ShopStruct.shopitem[13, 7].num   = 75;
            ShopStruct.shopitem[13, 7].value = 1;
            ShopStruct.shopitem[13, 7].refin = 0;
            ShopStruct.shopitem[13, 7].price = 1000;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[14].map        = 169;
            ShopStruct.shop[14].x          = 11;
            ShopStruct.shop[14].y          = 6;
            ShopStruct.shop[14].item_count = 1;

            ShopStruct.shopitem[14, 1].type  = 1;
            ShopStruct.shopitem[14, 1].num   = 68;
            ShopStruct.shopitem[14, 1].value = 1;
            ShopStruct.shopitem[14, 1].refin = 0;
            ShopStruct.shopitem[14, 1].price = 100000;// 225;


            //Manual, no editor, sorry :/
            ShopStruct.shop[15].map        = 219;
            ShopStruct.shop[15].x          = 11;
            ShopStruct.shop[15].y          = 6;
            ShopStruct.shop[15].item_count = 11;

            ShopStruct.shopitem[15, 1].type  = 3;
            ShopStruct.shopitem[15, 1].num   = 7;
            ShopStruct.shopitem[15, 1].value = 1;
            ShopStruct.shopitem[15, 1].refin = 0;
            ShopStruct.shopitem[15, 1].price = 300;// 225;

            ShopStruct.shopitem[15, 2].type  = 3;
            ShopStruct.shopitem[15, 2].num   = 8;
            ShopStruct.shopitem[15, 2].value = 1;
            ShopStruct.shopitem[15, 2].refin = 0;
            ShopStruct.shopitem[15, 2].price = 600;// 225;

            ShopStruct.shopitem[15, 3].type  = 3;
            ShopStruct.shopitem[15, 3].num   = 9;
            ShopStruct.shopitem[15, 3].value = 1;
            ShopStruct.shopitem[15, 3].refin = 0;
            ShopStruct.shopitem[15, 3].price = 1100;// 225;

            ShopStruct.shopitem[15, 4].type  = 3;
            ShopStruct.shopitem[15, 4].num   = 10;
            ShopStruct.shopitem[15, 4].value = 1;
            ShopStruct.shopitem[15, 4].refin = 0;
            ShopStruct.shopitem[15, 4].price = 1800;// 225;

            ShopStruct.shopitem[15, 5].type  = 3;
            ShopStruct.shopitem[15, 5].num   = 11;
            ShopStruct.shopitem[15, 5].value = 1;
            ShopStruct.shopitem[15, 5].refin = 0;
            ShopStruct.shopitem[15, 5].price = 2500;// 225;

            ShopStruct.shopitem[15, 6].type  = 3;
            ShopStruct.shopitem[15, 6].num   = 12;
            ShopStruct.shopitem[15, 6].value = 1;
            ShopStruct.shopitem[15, 6].refin = 0;
            ShopStruct.shopitem[15, 6].price = 4000;// 225;

            ShopStruct.shopitem[15, 7].type  = 3;
            ShopStruct.shopitem[15, 7].num   = 13;
            ShopStruct.shopitem[15, 7].value = 1;
            ShopStruct.shopitem[15, 7].refin = 0;
            ShopStruct.shopitem[15, 7].price = 6200;// 225;

            ShopStruct.shopitem[15, 8].type  = 3;
            ShopStruct.shopitem[15, 8].num   = 25;
            ShopStruct.shopitem[15, 8].value = 1;
            ShopStruct.shopitem[15, 8].refin = 0;
            ShopStruct.shopitem[15, 8].price = 9300;// 225;

            ShopStruct.shopitem[15, 9].type  = 3;
            ShopStruct.shopitem[15, 9].num   = 26;
            ShopStruct.shopitem[15, 9].value = 1;
            ShopStruct.shopitem[15, 9].refin = 0;
            ShopStruct.shopitem[15, 9].price = 13800;// 225;

            ShopStruct.shopitem[15, 10].type  = 3;
            ShopStruct.shopitem[15, 10].num   = 27;
            ShopStruct.shopitem[15, 10].value = 1;
            ShopStruct.shopitem[15, 10].refin = 0;
            ShopStruct.shopitem[15, 10].price = 17100;// 225;

            ShopStruct.shopitem[15, 11].type  = 3;
            ShopStruct.shopitem[15, 11].num   = 30;
            ShopStruct.shopitem[15, 11].value = 1;
            ShopStruct.shopitem[15, 11].refin = 0;
            ShopStruct.shopitem[15, 11].price = 22400;// 225;

            //Manual, no editor, sorry :/
            ShopStruct.shop[16].map        = 220;
            ShopStruct.shop[16].x          = 11;
            ShopStruct.shop[16].y          = 6;
            ShopStruct.shop[16].item_count = 7;

            ShopStruct.shopitem[16, 1].type  = 1;
            ShopStruct.shopitem[16, 1].num   = 1;
            ShopStruct.shopitem[16, 1].value = 1;
            ShopStruct.shopitem[16, 1].refin = 0;
            ShopStruct.shopitem[16, 1].price = 75;// 225;

            ShopStruct.shopitem[16, 2].type  = 1;
            ShopStruct.shopitem[16, 2].num   = 2;
            ShopStruct.shopitem[16, 2].value = 1;
            ShopStruct.shopitem[16, 2].refin = 0;
            ShopStruct.shopitem[16, 2].price = 75;// 225;

            ShopStruct.shopitem[16, 3].type  = 1;
            ShopStruct.shopitem[16, 3].num   = 69;
            ShopStruct.shopitem[16, 3].value = 1;
            ShopStruct.shopitem[16, 3].refin = 0;
            ShopStruct.shopitem[16, 3].price = 500;// 225;

            ShopStruct.shopitem[16, 4].type  = 1;
            ShopStruct.shopitem[16, 4].num   = 73;
            ShopStruct.shopitem[16, 4].value = 1;
            ShopStruct.shopitem[16, 4].refin = 0;
            ShopStruct.shopitem[16, 4].price = 200;// 225;

            ShopStruct.shopitem[16, 5].type  = 1;
            ShopStruct.shopitem[16, 5].num   = 72;
            ShopStruct.shopitem[16, 5].value = 1;
            ShopStruct.shopitem[16, 5].refin = 0;
            ShopStruct.shopitem[16, 5].price = 700;// 225;

            ShopStruct.shopitem[16, 6].type  = 1;
            ShopStruct.shopitem[16, 6].num   = 74;
            ShopStruct.shopitem[16, 6].value = 1;
            ShopStruct.shopitem[16, 6].refin = 0;
            ShopStruct.shopitem[16, 6].price = 500;// 225;

            ShopStruct.shopitem[16, 7].type  = 1;
            ShopStruct.shopitem[16, 7].num   = 75;
            ShopStruct.shopitem[16, 7].value = 1;
            ShopStruct.shopitem[16, 7].refin = 0;
            ShopStruct.shopitem[16, 7].price = 1000;// 225;

            Log("Carregado.");
            Log("Carregando Receitas...");
            Database.LoadRecipes();
            Log("Carregado.");
            Log("Carregando Guildas...");
            Database.LoadGuilds();
            Log("Carregado.");
            Log("");
            Log("Definingo váriaveis...");
            rdn = new Random();
            Log("OK.");
            Log("");
            Log("Iniciando Loop do servidor...");
            Log("Iniciando conexão TCP/IP...");
            Log(Globals.SMTP_USER);
            //Lidar com fechamento
            event_handler = new ConsoleEventDelegate(ConsoleEventCallback);
            SetConsoleCtrlHandler(event_handler, true);

            //Clientes
            Clients = new List <StateObject>(100);

            // Create the thread object, passing in the Alpha.Beta method
            // via a ThreadStart delegate. This does not start the thread.
            Thread sThread = new Thread(new ThreadStart(Loops.BetaLoop));

            // Start the thread
            sThread.Start();

            //Iniciar conexão
            // Data buffer for incoming data.
            byte[] bytes = new Byte[1024];

            // Establish the local endpoint for the socket.
            // The DNS name of the computer
            // running the listener is "host.contoso.com".
            IPHostEntry ipHostInfo    = Dns.GetHostEntry(Dns.GetHostName());
            IPAddress   ipAddress     = IPAddress.Any;//ipHostInfo.AddressList[0];
            IPEndPoint  localEndPoint = new IPEndPoint(ipAddress, 8000);

            // Create a TCP/IP socket.
            listener = new Socket(AddressFamily.InterNetwork,
                                  SocketType.Stream, ProtocolType.Tcp);
            listener.Bind(localEndPoint);
            listener.Listen(100);
            listener.NoDelay = true;

            // Create the thread object, passing in the Alpha.Beta method
            // via a ThreadStart delegate. This does not start the thread.
            Thread lThread = new Thread(new ThreadStart(Listen));

            // Start the thread
            lThread.Start();

            //Loop principal
            Loops.AlphaLoop();
        }
示例#6
0
        //*********************************************************************************************
        // AlphaLoop / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon
        // Trabalha com informações direcionadas ao jogo e os jogadores.
        //*********************************************************************************************
        public static void AlphaLoop()
        {
            //EXTEND
            if (Extensions.ExtensionApp.ExtendMyApp
                    (MethodBase.GetCurrentMethod().Name) != null)
            {
                return;
            }

            //CÓDIGO
            long tmr100;
            long tmr256;
            long Tick;

            tmr100 = 0;
            tmr256 = 0;
            Database.DefineAdmin();
            WinsockAsync.Log(lang.server_started_in_date + " " + DateTime.Now);

            do
            {
                Tick = TickCount.ElapsedMilliseconds;

                //EXTEND
                if (Extensions.ExtensionApp.ExtendMyApp
                        ("alpha_inject", Tick) != null)
                {
                    return;
                }

                //WinsockAsync.Listen();

                Command = "First For";
                for (int i = 1; i <= Globals.Player_Highindex; i++)
                {
                    if (PStruct.tempplayer[i].ingame)
                    {
                        PStruct.PetMove(i);
                    }
                    if ((PStruct.tempplayer[i].SORE) && (PStruct.character[i, PStruct.player[i].SelectedChar].PVPPenalty < Loops.TickCount.ElapsedMilliseconds))
                    {
                        PStruct.tempplayer[i].SORE = false;
                        PStruct.character[i, PStruct.player[i].SelectedChar].PVPPenalty = 0;
                        SendData.Send_PlayerSoreToMap(i);
                        SendData.Send_Animation(PStruct.character[i, PStruct.player[i].SelectedChar].Map, Globals.Target_Player, i, 148);
                    }
                    for (int p = 1; p < Globals.MaxPassiveEffects; p++)
                    {
                        if ((PStruct.ppassiveffect[i, p].active) && (Tick > PStruct.ppassiveffect[i, p].timer))
                        {
                            PStruct.ExecutePassiveEffect(i, p);
                        }
                    }
                    if (PStruct.tempplayer[i].RegenTimer < Tick)
                    {
                        PStruct.PlayerRegen(i);
                    }
                    if ((PStruct.tempplayer[i].preparingskill > 0) && (Tick > PStruct.tempplayer[i].skilltimer))
                    {
                        PlayerLogic.ExecuteSkill(i);
                    }
                    //Dano sobre tempo
                    for (int s = 1; s < Globals.MaxNTempSpells; s++)
                    {
                        if ((PStruct.ptempspell[i, s].active) && (Tick > PStruct.ptempspell[i, s].timer))
                        {
                            PStruct.ExecuteTempSpell(i, s);
                        }
                    }
                    if ((PStruct.tempplayer[i].Stunned) && (PStruct.tempplayer[i].StunTimer < Tick))
                    {
                        SendData.Send_Stun(PStruct.character[i, PStruct.player[i].SelectedChar].Map, 1, i, 0);
                        PStruct.tempplayer[i].Stunned = false;
                    }
                    if ((PStruct.tempplayer[i].Sleeping) && (PStruct.tempplayer[i].SleepTimer < Tick))
                    {
                        SendData.Send_Sleep(PStruct.character[i, PStruct.player[i].SelectedChar].Map, 1, i, 0);
                        PStruct.tempplayer[i].Sleeping = false;
                    }
                    if ((PStruct.tempplayer[i].Blind) && (PStruct.tempplayer[i].BlindTimer < Tick))
                    {
                        //SendData.Send_Stun(PStruct.character[i, PStruct.player[i].SelectedChar].Map, 1, i, 0);
                        PStruct.tempplayer[i].Blind = false;
                    }
                    if ((PStruct.tempplayer[i].Slowed) && (PStruct.tempplayer[i].SlowTimer < Tick))
                    {
                        if (PStruct.tempplayer[i].isFrozen)
                        {
                            PStruct.tempplayer[i].isFrozen = false;
                            SendData.Send_Frozen(Globals.Target_Player, i);
                        }
                        PStruct.tempplayer[i].Slowed    = false;
                        PStruct.tempplayer[i].movespeed = Globals.NormalMoveSpeed;
                        SendData.Send_MoveSpeed(Globals.Target_Player, i);
                    }
                }


                Command = "tmr100";
                if (tmr100 < Tick)
                {
                    for (int i = 0; i <= WinsockAsync.Clients.Count - 1; i++)
                    {
                        if (!WinsockAsync.Clients[i].IsConnected)
                        {
                            if (WinsockAsync.Clients[i].index >= 0)
                            {
                                WinsockAsync.DisconnectUser(i);
                            }
                        }
                    }

                    for (int i = 0; i <= Globals.Max_WorkPoints - 1; i++)
                    {
                        if ((MStruct.tempworkpoint[i].respawn > 0) && (Loops.TickCount.ElapsedMilliseconds > MStruct.tempworkpoint[i].respawn))
                        {
                            MStruct.tempworkpoint[i].vitality = MStruct.workpoint[i].vitality;
                            MStruct.tempworkpoint[i].respawn  = 0;
                            SendData.Send_EventGraphicToMap(MStruct.workpoint[i].map, MStruct.tile[MStruct.workpoint[i].map, MStruct.workpoint[i].x, MStruct.workpoint[i].y].Event_Id, "", 0, Convert.ToByte(MStruct.workpoint[i].active_sprite));
                        }
                    }

                    tmr100 = Tick + 100;
                }

                Command = "tmr256";

                if (tmr256 < Tick)
                {
                    for (int i = 0; i < Globals.MaxMaps; i++)
                    {
                        MStruct.CheckMapItems(i);

                        if (MStruct.tempmap[i].WarActive)
                        {
                            if (Tick > MStruct.tempmap[i].WarTimer)
                            {
                                bool b = false;
                                for (int i2 = 0; i2 <= MStruct.tempmap[i].NpcCount; i2++)
                                {
                                    if (NStruct.tempnpc[i, i2].guildnum > 0)
                                    {
                                        if (NStruct.tempnpc[i, i2].Target > 0)
                                        {
                                            MStruct.tempmap[i].WarTimer += Tick + 20000;
                                            b = true;
                                        }
                                        NStruct.RegenNpc(i, i2, true);
                                    }
                                }
                                if (b)
                                {
                                    break;
                                }
                                SendData.Send_MsgToGuild(MStruct.map[i].guildnum, lang.the_colector_of + " " + MStruct.map[i].name + " " + lang.has_survived, Globals.ColorYellow, Globals.Msg_Type_Server);
                                MStruct.tempmap[i].WarActive = false;
                            }
                        }
                        Command = "NPC COUNT";
                        for (int i2 = 0; i2 <= MStruct.tempmap[i].NpcCount; i2++)
                        {
                            if (i2 > 0)
                            {
                                Command = "TIME DAMAGE";
                                //Dano sobre tempo
                                for (int s = 1; s < Globals.MaxNTempSpells; s++)
                                {
                                    if ((NStruct.ntempspell[i, i2, s].active) && (Tick > NStruct.ntempspell[i, i2, s].timer))
                                    {
                                        NStruct.ExecuteTempSpell(i, i2, s);
                                    }
                                }

                                //Processamento do NPC
                                if (MStruct.ExistPlayerInMap(i))
                                {
                                    Command = "NPC MOVE";
                                    NpcIA.CheckNpcMove(i, i2);
                                    if ((NStruct.tempnpc[i, i2].preparingskill > 0) && (Tick > NStruct.tempnpc[i, i2].skilltimer))
                                    {
                                        Command = "NPC EXECUTE SKILL";
                                        NpcIA.ExecuteSkill(i, i2);
                                    }
                                    if (NStruct.tempnpc[i, i2].RegenTimer < Tick)
                                    {
                                        Command = "REGEN NPC";
                                        NStruct.RegenNpc(i, i2);
                                    }
                                    if ((NStruct.tempnpc[i, i2].Stunned) && (NStruct.tempnpc[i, i2].StunTimer < Tick))
                                    {
                                        Command = "NPC STUN";
                                        SendData.Send_Stun(i, 2, i2, 0);
                                        NStruct.tempnpc[i, i2].Stunned = false;
                                    }
                                    if ((NStruct.tempnpc[i, i2].Sleeping) && (NStruct.tempnpc[i, i2].SleepTimer < Tick))
                                    {
                                        Command = "NPC SLEEP";
                                        SendData.Send_Sleep(i, 2, i2, 0);
                                        NStruct.tempnpc[i, i2].Sleeping = false;
                                    }
                                    if ((NStruct.tempnpc[i, i2].Blind) && (NStruct.tempnpc[i, i2].BlindTimer < Tick))
                                    {
                                        Command = "NPC BLIND";
                                        // A fazer SendData.Send_Stun(i, 2, i2, 0);
                                        NStruct.tempnpc[i, i2].Blind = false;
                                    }
                                    if ((NStruct.tempnpc[i, i2].Slowed) && (NStruct.tempnpc[i, i2].SlowTimer < Tick))
                                    {
                                        if (NStruct.tempnpc[i, i2].isFrozen)
                                        {
                                            NStruct.tempnpc[i, i2].isFrozen = false;
                                            SendData.Send_Frozen(Globals.Target_Npc, i2, i);
                                        }
                                        NStruct.tempnpc[i, i2].Slowed    = false;
                                        NStruct.tempnpc[i, i2].movespeed = Globals.NormalMoveSpeed;
                                        SendData.Send_MoveSpeed(Globals.Target_Npc, i2, i);
                                    }
                                }
                                else
                                {
                                    Command = "NPC SUPER REGEN";
                                    NStruct.RegenNpc(i, i2, true);
                                    if (NStruct.tempnpc[i, i2].Target > 0)
                                    {
                                        NStruct.tempnpc[i, i2].Target = 0;
                                    }
                                }
                                Command = "NPC RESPAWN";
                                if ((NStruct.tempnpc[i, i2].Dead == true) && (Tick > NStruct.tempnpc[i, i2].RespawnTimer))
                                {
                                    //Respawn
                                    NpcIA.NpcRespawned(i, i2);
                                }
                            }
                        }
                        //for (int i2 = 0; i2 <= MStruct.Ge; i2++)
                        // {
                        //}
                    }
                    tmr256 = Tick + 256;
                }
                long test1 = Tick;
                Command = "Save Timer";
                if (Save_Timer < TickCount.ElapsedMilliseconds)
                {                        //Salva o jogador SE PRECISAR
                    if (WinsockAsync.Clients.Count > 0)
                    {
                        for (int i = 0; i < WinsockAsync.Clients.Count; i++)
                        {
                            if (PStruct.tempplayer[WinsockAsync.Clients[i].index].ingame)
                            {
                                Database.SaveCharacter(WinsockAsync.Clients[i].index, PStruct.player[WinsockAsync.Clients[i].index].Email, PStruct.player[WinsockAsync.Clients[i].index].SelectedChar);
                                Database.SaveBank(WinsockAsync.Clients[i].index);
                            }
                        }
                    }
                    Save_Timer = TickCount.ElapsedMilliseconds + 600000;
                    Console.WriteLine(lang.server_has_been_saved);
                }

                Command = "TPP";
                if ((test1 - Tick) > 0)
                {
                    Console.WriteLine("TPP: " + (test1 - Tick));
                }
                Thread.Sleep(10);
            }while (true);
        }
示例#7
0
        //*********************************************************************************************
        // ExecuteTempSpell / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon
        //*********************************************************************************************
        public static void ExecuteTempSpell(int Map, int index, int NStempSpell)
        {
            //EXTEND
            if (Extensions.ExtensionApp.ExtendMyApp
                    (MethodBase.GetCurrentMethod().Name, Map, index, NStempSpell) != null)
            {
                return;
            }

            //CÓDIGO
            int Attacker = NStruct.ntempspell[Map, index, NStempSpell].attacker;

            if ((UserConnection.Getindex(Attacker) < 0) || (UserConnection.Getindex(Attacker) >= WinsockAsync.Clients.Count()))
            {
                NStruct.ntempspell[Map, index, NStempSpell].attacker = 0;
                NStruct.ntempspell[Map, index, NStempSpell].timer    = 0;
                NStruct.ntempspell[Map, index, NStempSpell].spellnum = 0;
                NStruct.ntempspell[Map, index, NStempSpell].repeats  = 0;
                NStruct.ntempspell[Map, index, NStempSpell].active   = false;
                return;
            }

            //Verificar se o jogador não se desconectou no processo
            if (!WinsockAsync.Clients[(UserConnection.Getindex(Attacker))].IsConnected)
            {
                NStruct.ntempspell[Map, index, NStempSpell].attacker = 0;
                NStruct.ntempspell[Map, index, NStempSpell].timer    = 0;
                NStruct.ntempspell[Map, index, NStempSpell].spellnum = 0;
                NStruct.ntempspell[Map, index, NStempSpell].repeats  = 0;
                NStruct.ntempspell[Map, index, NStempSpell].active   = false;
                return;
            }

            if (NStruct.tempnpc[Map, index].Vitality <= 0)
            {
                NStruct.ntempspell[Map, index, NStempSpell].attacker = 0;
                NStruct.ntempspell[Map, index, NStempSpell].timer    = 0;
                NStruct.ntempspell[Map, index, NStempSpell].spellnum = 0;
                NStruct.ntempspell[Map, index, NStempSpell].repeats  = 0;
                NStruct.ntempspell[Map, index, NStempSpell].active   = false;
                return;
            }

            SendData.Send_Animation(Map, 2, index, NStruct.ntempspell[Map, index, NStempSpell].anim);

            if (NStruct.ntempspell[Map, index, NStempSpell].area_range <= 0)
            {
                PStruct.PlayerAttackNpc(Attacker, index, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
            }
            else
            {
                PStruct.PlayerAttackNpc(Attacker, index, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                for (int i = 0; i <= Globals.Player_Highindex; i++)
                {
                    if ((PStruct.character[i, PStruct.player[i].SelectedChar].Map == Map) && (PStruct.character[index, PStruct.player[index].SelectedChar].PVP) && (i != index))
                    {
                        for (int r = 1; r <= NStruct.ntempspell[Map, index, NStempSpell].area_range; r++)
                        {
                            if ((PStruct.character[i, PStruct.player[i].SelectedChar].X - r == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                            if ((PStruct.character[i, PStruct.player[i].SelectedChar].X + r == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                            if ((PStruct.character[i, PStruct.player[i].SelectedChar].X == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y - r == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                            if ((PStruct.character[i, PStruct.player[i].SelectedChar].X == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y + r == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }


                            //Is line?
                            if (NStruct.ntempspell[Map, index, NStempSpell].is_line)
                            {
                                if ((PStruct.character[i, PStruct.player[i].SelectedChar].X - r == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y + r == NStruct.tempnpc[Map, index].Y))
                                {
                                    PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                                }
                                if ((PStruct.character[i, PStruct.player[i].SelectedChar].X + r == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y - r == NStruct.tempnpc[Map, index].Y))
                                {
                                    PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                                }
                                if ((PStruct.character[i, PStruct.player[i].SelectedChar].X + r == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y + r == NStruct.tempnpc[Map, index].Y))
                                {
                                    PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                                }
                                if ((PStruct.character[i, PStruct.player[i].SelectedChar].X - r == NStruct.tempnpc[Map, index].X) && (PStruct.character[i, PStruct.player[i].SelectedChar].Y - r == NStruct.tempnpc[Map, index].Y))
                                {
                                    PStruct.PlayerAttackPlayer(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                                }
                            }
                        }
                    }
                }

                for (int i = 0; i <= MStruct.tempmap[Map].NpcCount; i++)
                {
                    for (int r = 1; r <= NStruct.ntempspell[Map, index, NStempSpell].area_range; r++)
                    {
                        if ((NStruct.tempnpc[Map, i].X - r == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y == NStruct.tempnpc[Map, index].Y))
                        {
                            PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                        }
                        if ((NStruct.tempnpc[Map, i].X + r == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y == NStruct.tempnpc[Map, index].Y))
                        {
                            PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                        }
                        if ((NStruct.tempnpc[Map, i].X == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y - r == NStruct.tempnpc[Map, index].Y))
                        {
                            PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                        }
                        if ((NStruct.tempnpc[Map, i].X == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y + r == NStruct.tempnpc[Map, index].Y))
                        {
                            PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                        }


                        //Is line?
                        if (NStruct.ntempspell[Map, index, NStempSpell].is_line)
                        {
                            if ((NStruct.tempnpc[Map, i].X - r == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y + r == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                            if ((NStruct.tempnpc[Map, i].X + r == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y - r == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                            if ((NStruct.tempnpc[Map, i].X + r == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y + r == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                            if ((NStruct.tempnpc[Map, i].X - r == NStruct.tempnpc[Map, index].X) && (NStruct.tempnpc[Map, i].Y - r == NStruct.tempnpc[Map, index].Y))
                            {
                                PStruct.PlayerAttackNpc(Attacker, i, NStruct.ntempspell[Map, index, NStempSpell].spellnum, Map);
                            }
                        }
                    }
                }
            }

            NStruct.ntempspell[Map, index, NStempSpell].repeats -= 1;

            if (NStruct.ntempspell[Map, index, NStempSpell].repeats <= 0)
            {
                if (SStruct.skill[NStruct.ntempspell[Map, index, NStempSpell].spellnum].slow)
                {
                    NStruct.tempnpc[Map, index].movespeed = NStruct.npc[Map, index].SpeedMove / 64;
                    SendData.Send_MoveSpeed(2, index, Map);
                }
                NStruct.ntempspell[Map, index, NStempSpell].attacker = 0;
                NStruct.ntempspell[Map, index, NStempSpell].timer    = 0;
                NStruct.ntempspell[Map, index, NStempSpell].spellnum = 0;
                NStruct.ntempspell[Map, index, NStempSpell].repeats  = 0;
                NStruct.ntempspell[Map, index, NStempSpell].active   = false;
            }

            NStruct.ntempspell[Map, index, NStempSpell].timer = Loops.TickCount.ElapsedMilliseconds + SStruct.skill[NStruct.ntempspell[Map, index, NStempSpell].spellnum].interval;
        }
示例#8
0
        //*********************************************************************************************
        // Main / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon
        // Iniciamos o servidor aqui.
        //*********************************************************************************************
        static void Main(string[] args)
        {
            LoadLang();
            Console.WriteLine("");
            Console.WriteLine("///////////////////////////////////////////////////////");
            Console.WriteLine("/                                                     /");
            Console.WriteLine(@"/        ___          _                               /");
            Console.WriteLine(@"/       / __\__  _ __(_) ___ _ __ _   _ _ __ ___      /");
            Console.WriteLine(@"/      / _\/ _ \| '__| |/ _ \ '__| | | | '_ ` _ \     /");
            Console.WriteLine(@"/     / / | (_) | |  | |  __/ |  | |_| | | | | | |    /");
            Console.WriteLine(@"/     \/   \___/|_| _/ |\___|_|   \__,_|_| |_| |_|    /");
            Console.WriteLine(@"/                  |__/                               /");
            Console.WriteLine("/                                                     /");
            Console.WriteLine("/                 http://4tabern.com                  /");
            Console.WriteLine("/         Copyright (C) 2016 Allyson S. Bacon         /");
            Console.WriteLine("/                                                     /");
            Console.WriteLine("///////////////////////////////////////////////////////");

            Console.WriteLine("");
            Console.WriteLine(lang.making_the_query_extensions_in_project);
            Extensions.ExtensionApp.InstanceTypes();

            //EXTEND
            if (Extensions.ExtensionApp.ExtendMyApp
                    (MethodBase.GetCurrentMethod().Name, args) != null)
            {
                return;
            }

            //CÓDIGO PARA RESETAR JOGADORES
            //PStruct.InitializePlayerArrays();
            //Database.ResetAndGiveExp();

            Log(Languages.LStruct.lang.starting_server);
            Log(lang.setting_global_names);
            Globals.GAME_NAME = Database.GET_GAME_NAME();
            Globals.MOTD      = Database.GET_MOTD();
            Globals.NOTICE    = Database.GET_NOTICE();
            Log(lang.starting_server);
            Log(lang.client_defined);
            Log("");
            Log(lang.starting_player_arrays);
            PStruct.InitializePlayerArrays();
            Log(lang.starting_guild_arrays);
            GStruct.InitializeGuildArrays();
            Log(lang.arrays_started);
            Log("");
            Log(lang.loading_enemies);
            Database.LoadEnemies();
            Log(lang.loaded);
            Log(lang.loading_maps_monsters_and_missions);
            Database.LoadMaps();
            Log(lang.loaded);
            Log(lang.loading_items);
            Database.LoadItems();
            Log(lang.loaded);
            Log(lang.loading_weapons);
            Database.LoadWeapons();
            Log(lang.loaded);
            Log(lang.loading_armors);
            Database.LoadArmors();
            Log(lang.loaded);
            Log(lang.loading_skills);
            Database.LoadSkills();
            Log(lang.loaded);
            Log(lang.loading_shops);
            Database.LoadShops();
            //Rudimentar :/
            Database.LoadShopsRud();
            Log(lang.loaded);
            Log(lang.loading_recipes);
            Database.LoadRecipes();
            Log(lang.loaded);
            Log(lang.loading_guilds);
            Database.LoadGuilds();
            Log(lang.loaded);
            Log(lang.loading_classes);
            Database.DEFINE_CLASSES_DATA();
            Log(lang.loaded);
            Log("");
            Log(lang.setting_variables);
            rdn = new Random();
            Log(lang.OK);
            Log("");
            Log(lang.starting_server_loop);
            Log(lang.starting_tcpip_connection);

            WinsockAsync.start();
        }