Esempio n. 1
0
 private static void LoadGameData()
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine("Loading Classes..."); modDatabase.LoadClasses();
     Console.WriteLine("Loading Maps..."); modDatabase.LoadMaps();
     Console.WriteLine("Creating Map Matrices...");
     for (int i = 1; i < Constants.MAX_MAPS; i++)
     {
         modPathfinding.CreatePathMatrix(i);
     }
     Console.WriteLine("Loading Items..."); S_Items.LoadItems();
     Console.WriteLine("Loading Npc's..."); modDatabase.LoadNpcs();
     Console.WriteLine("Loading Resources..."); S_Resources.LoadResources();
     Console.WriteLine("Loading Shops..."); modDatabase.LoadShops();
     Console.WriteLine("Loading Skills..."); modDatabase.LoadSkills();
     Console.WriteLine("Loading Animations..."); S_Animations.LoadAnimations();
     Console.WriteLine("Loading Quests..."); S_Quest.LoadQuests();
     Console.WriteLine("Loading House Configurations..."); S_Housing.LoadHouses();
     Console.WriteLine("Loading Switches..."); S_Events.LoadSwitches();
     Console.WriteLine("Loading Variables..."); S_Events.LoadVariables();
     Console.WriteLine("Spawning global events..."); S_EventLogic.SpawnAllMapGlobalEvents();
     Console.WriteLine("Loading projectiles..."); S_Projectiles.LoadProjectiles();
     Console.WriteLine("Loading Recipes..."); modCrafting.LoadRecipes();
     Console.WriteLine("Loading Pets..."); S_Pets.LoadPets();
     Console.ResetColor();
 }
Esempio n. 2
0
 internal static void ClearGameData()
 {
     Console.WriteLine("Clearing temp tile fields..."); modDatabase.ClearTempTiles();
     Console.WriteLine("Clearing Maps..."); modDatabase.ClearMaps();
     Console.WriteLine("Clearing Map Items..."); modDatabase.ClearMapItems();
     Console.WriteLine("Clearing Map Npc's..."); modDatabase.ClearAllMapNpcs();
     Console.WriteLine("Clearing Npc's..."); modDatabase.ClearNpcs();
     Console.WriteLine("Clearing Resources..."); S_Resources.ClearResources();
     Console.WriteLine("Clearing Items..."); S_Items.ClearItems();
     Console.WriteLine("Clearing Shops..."); modDatabase.ClearShops();
     Console.WriteLine("Clearing Skills..."); modDatabase.ClearSkills();
     Console.WriteLine("Clearing Animations..."); S_Animations.ClearAnimations();
     Console.WriteLine("Clearing Quests..."); S_Quest.ClearQuests();
     Console.WriteLine("Clearing map projectiles..."); S_Projectiles.ClearMapProjectiles();
     Console.WriteLine("Clearing projectiles..."); S_Projectiles.ClearProjectiles();
     Console.WriteLine("Clearing Recipes..."); modCrafting.ClearRecipes();
     Console.WriteLine("Clearing pets..."); S_Pets.ClearPets();
 }
Esempio n. 3
0
 private static void LoadGameData()
 {
     Console.WriteLine("Loading Classes..."); modDatabase.LoadClasses();
     Console.WriteLine("Loading Maps..."); modDatabase.LoadMaps();
     Console.WriteLine("Loading Items..."); S_Items.LoadItems();
     Console.WriteLine("Loading Npc's..."); modDatabase.LoadNpcs();
     Console.WriteLine("Loading Resources..."); S_Resources.LoadResources();
     Console.WriteLine("Loading Shops..."); modDatabase.LoadShops();
     Console.WriteLine("Loading Skills..."); modDatabase.LoadSkills();
     Console.WriteLine("Loading Animations..."); S_Animations.LoadAnimations();
     Console.WriteLine("Loading Quests..."); S_Quest.LoadQuests();
     Console.WriteLine("Loading House Configurations..."); S_Housing.LoadHouses();
     Console.WriteLine("Loading Switches..."); S_Events.LoadSwitches();
     Console.WriteLine("Loading Variables..."); S_Events.LoadVariables();
     Console.WriteLine("Spawning global events..."); S_EventLogic.SpawnAllMapGlobalEvents();
     Console.WriteLine("Loading projectiles..."); S_Projectiles.LoadProjectiles();
     Console.WriteLine("Loading Recipes..."); modCrafting.LoadRecipes();
     Console.WriteLine("Loading Pets..."); S_Pets.LoadPets();
 }
Esempio n. 4
0
        public static void CheckResource(int index, int x, int y)
        {
            int  Resource_num;
            byte ResourceType;
            int  Resource_index;
            int  rX;
            int  rY;
            int  Damage;

            if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == (byte)Enums.TileType.Resource)
            {
                Resource_num   = 0;
                Resource_index = modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Data1;
                ResourceType   = (byte)Types.Resource[Resource_index].ResourceType;
                var loopTo = ResourceCache[S_Players.GetPlayerMap(index)].ResourceCount;

                // Get the cache number
                for (var i = 0; i <= loopTo; i++)
                {
                    if (ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[i].X == x)
                    {
                        if (ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[i].Y == y)
                        {
                            Resource_num = i;
                        }
                    }
                }

                if (Resource_num > 0)
                {
                    if (S_Players.GetPlayerEquipment(index, Enums.EquipmentType.Weapon) > 0 || Types.Resource[Resource_index].ToolRequired == 0)
                    {
                        if (Types.Item[S_Players.GetPlayerEquipment(index, Enums.EquipmentType.Weapon)].Data3 == Types.Resource[Resource_index].ToolRequired)
                        {
                            // inv space?
                            if (Types.Resource[Resource_index].ItemReward > 0)
                            {
                                if (S_Players.FindOpenInvSlot(index, Types.Resource[Resource_index].ItemReward) == 0)
                                {
                                    S_NetworkSend.PlayerMsg(index, "You have no inventory space.", (int)Enums.ColorType.Yellow);
                                    return;
                                }
                            }

                            // required lvl?
                            if (Types.Resource[Resource_index].LvlRequired > GetPlayerGatherSkillLvl(index, ResourceType))
                            {
                                S_NetworkSend.PlayerMsg(index, "Your level is too low!", (int)Enums.ColorType.Yellow);
                                return;
                            }

                            // check if already cut down
                            if (ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].ResourceState == 0)
                            {
                                rX = ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].X;
                                rY = ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].Y;

                                if (Types.Resource[Resource_index].ToolRequired == 0)
                                {
                                    Damage = 1 * GetPlayerGatherSkillLvl(index, ResourceType);
                                }
                                else
                                {
                                    Damage = Types.Item[S_Players.GetPlayerEquipment(index, Enums.EquipmentType.Weapon)].Data2;
                                }

                                // check if damage is more than health
                                if (Damage > 0)
                                {
                                    // cut it down!
                                    if (ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].CurHealth - Damage <= 0)
                                    {
                                        ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].ResourceState = 1; // Cut
                                        ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].ResourceTimer = S_General.GetTimeMs();
                                        SendResourceCacheToMap(S_Players.GetPlayerMap(index), Resource_num);
                                        S_NetworkSend.SendActionMsg(S_Players.GetPlayerMap(index), Types.Resource[Resource_index].SuccessMessage.Trim(), (int)Enums.ColorType.BrightGreen, 1, (S_Players.GetPlayerX(index) * 32), (S_Players.GetPlayerY(index) * 32));
                                        S_Players.GiveInvItem(index, Types.Resource[Resource_index].ItemReward, 1);
                                        S_Animations.SendAnimation(S_Players.GetPlayerMap(index), Types.Resource[Resource_index].Animation, rX, rY);
                                        SetPlayerGatherSkillExp(index, ResourceType, GetPlayerGatherSkillExp(index, ResourceType) + Types.Resource[Resource_index].ExpReward);
                                        // send msg
                                        S_NetworkSend.PlayerMsg(index, string.Format("Your {0} has earned {1} experience. ({2}/{3})", GetResourceSkillName((Enums.ResourceSkills)ResourceType), Types.Resource[Resource_index].ExpReward, GetPlayerGatherSkillExp(index, ResourceType), GetPlayerGatherSkillMaxExp(index, ResourceType)), (int)Enums.ColorType.BrightGreen);
                                        S_NetworkSend.SendPlayerData(index);

                                        CheckResourceLevelUp(index, ResourceType);
                                    }
                                    else
                                    {
                                        // just do the damage
                                        ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].CurHealth = (byte)(ResourceCache[S_Players.GetPlayerMap(index)].ResourceData[Resource_num].CurHealth - Damage);
                                        S_NetworkSend.SendActionMsg(S_Players.GetPlayerMap(index), "-" + Damage, (int)Enums.ColorType.BrightRed, 1, (rX * 32), (rY * 32));
                                        S_Animations.SendAnimation(S_Players.GetPlayerMap(index), Types.Resource[Resource_index].Animation, rX, rY);
                                    }
                                    S_Quest.CheckTasks(index, (int)Enums.QuestType.Gather, Resource_index);
                                }
                                else
                                {
                                    // too weak
                                    S_NetworkSend.SendActionMsg(S_Players.GetPlayerMap(index), "Miss!", (int)Enums.ColorType.BrightRed, 1, (rX * 32), (rY * 32));
                                }
                            }
                            else
                            {
                                S_NetworkSend.SendActionMsg(S_Players.GetPlayerMap(index), Types.Resource[Resource_index].EmptyMessage.Trim(), (int)Enums.ColorType.BrightRed, 1, (S_Players.GetPlayerX(index) * 32), (S_Players.GetPlayerY(index) * 32));
                            }
                        }
                        else
                        {
                            S_NetworkSend.PlayerMsg(index, "You have the wrong type of tool equiped.", (int)Enums.ColorType.Yellow);
                        }
                    }
                    else
                    {
                        S_NetworkSend.PlayerMsg(index, "You need a tool to gather this resource.", (int)Enums.ColorType.Yellow);
                    }
                }
            }
        }