Exemple #1
0
 public Inventory(ListPair<int, DataManager.Characters.InventoryItem> loadedInventory)
 {
     items = new ListPair<int, InventoryItem>();
     for (int i = 0; i < loadedInventory.Count; i++) {
         items.Add(loadedInventory.KeyByIndex(i), new InventoryItem(loadedInventory.ValueByIndex(i)));
     }
 }
 public ShopCollection(int maxShops)
 {
     if (maxShops == 0)
         maxShops = 50;
     this.maxShops = maxShops;
     shops = new ListPair<int, Shop>();
 }
Exemple #3
0
 public MoveCollection(int maxMoves)
 {
     if (maxMoves == 0)
         maxMoves = 50;
     this.maxMoves = maxMoves;
     moves = new ListPair<int, Move>();
 }
Exemple #4
0
 public EvolutionCollection(int maxEvos)
 {
     if (maxEvos == 0)
         maxEvos = 50;
     this.maxEvos = maxEvos;
     evolutions = new ListPair<int,Evolution>();
 }
Exemple #5
0
        public void LoadShop(string[] parse)
        {
            pnlShopList.Visible   = false;
            pnlShopEditor.Visible = true;
            this.Size             = new System.Drawing.Size(pnlShopEditor.Width, pnlShopEditor.Height);


            txtName.Text     = parse[2];
            txtJoinSay.Text  = parse[3];
            txtLeaveSay.Text = parse[4];

            shopItemList = new ListPair <int, Client.Logic.Shops.ShopItem>();

            for (int i = 0; i < MaxInfo.MAX_TRADES; i++)
            {
                Shops.ShopItem shopItem = new Shops.ShopItem();
                shopItem.GiveItem  = parse[5 + i * 3].ToInt();
                shopItem.GiveValue = parse[6 + i * 3].ToInt();
                shopItem.GetItem   = parse[7 + i * 3].ToInt();

                shopItemList.Add(i, shopItem);
            }

            //if (lbxShopItems.SelectedItems.Count > 0) {

            //lbxShopItems.SelectItem(lbxShopItems.SelectedItems[0].TextIdentifier);

            //}


            RefreshShopItemList();
            lbxShopItems.SelectItem(0);

            btnEdit.Text = "Edit";
        }
Exemple #6
0
 public Dungeon()
 {
     standardMaps = new List <StandardDungeonMap>();
     randomMaps   = new List <RandomDungeonMap>();
     Name         = "";
     ScriptList   = new ListPair <int, string>();
 }
Exemple #7
0
 public NpcCollection(int maxNpcs)
 {
     if (maxNpcs == 0)
         maxNpcs = 50;
     this.maxNpcs = maxNpcs;
     npcs = new ListPair<int, Npc>();
 }
        static IEnumerable <bool> queens3(object UnplacedQs, object SafeQs, Variable Qs)
        {
            ListPair UnplacedQsListPair = YP.getValue(UnplacedQs) as ListPair;

            if (UnplacedQsListPair != null)
            {
                Variable UnplacedQs1 = new Variable();
                Variable Q           = new Variable();
                foreach (bool l1 in selectq(Q, UnplacedQsListPair, UnplacedQs1))
                {
                    if (!(SafeQs is ListPair && hasAttack((int)Q.getValue(), (ListPair)SafeQs)))
                    {
                        foreach (bool l2 in queens3(UnplacedQs1, new ListPair(Q, SafeQs), Qs))
                        {
                            yield return(false);
                        }
                    }
                }
            }
            else
            {
                foreach (bool l1 in Qs.unify(SafeQs))
                {
                    yield return(false);
                }
            }
        }
 public ItemCollection(int maxItems)
 {
     if (maxItems == 0)
         maxItems = 50;
     this.maxItems = maxItems;
     items = new ListPair<int, Item>();
 }
 public MapCollection(int maxMaps)
 {
     if (maxMaps == 0)
         maxMaps = 50;
     this.maxMaps = maxMaps;
     maps = new ListPair<int, Map>();
 }
Exemple #11
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("ID"), parameters.GetValue("ParentMapID"),
          parameters.GetValue("X").ToInt(), parameters.GetValue("Y").ToInt(),
          parameters.GetValue("Sprite").ToInt(), 0, Enums.Coloration.Normal, Enums.Sex.Genderless);
 }
        private IEnumerable <IMap> GetBorderingMaps(ListPair <IMap, Object[]> borderingMapCollection, IMap centralMap)
        {
            int mapIndex = borderingMapCollection.IndexOfKey(centralMap);

            if (mapIndex > -1)
            {
                Object[] maps = borderingMapCollection.ValueByIndex(mapIndex);
                foreach (IMap map in maps)
                {
                    if (map != null)
                    {
                        yield return(map);
                    }
                }
            }
            else
            {
                Object[] maps = new object[9];
                for (int borderingMapID = 0; borderingMapID < 9; borderingMapID++)
                {
                    if (MapManager.IsBorderingMapLoaded(centralMap, (Enums.MapID)borderingMapID))
                    {
                        IMap borderingMap = MapManager.RetrieveBorderingMap(centralMap, (Enums.MapID)borderingMapID, true);
                        if (borderingMap != null)
                        {
                            maps[borderingMapID] = borderingMap;
                            yield return(borderingMap);
                        }
                    }
                }
                borderingMapCollection.Add(centralMap, maps);
            }
        }
Exemple #13
0
 public Dungeon()
 {
     standardMaps = new List<StandardDungeonMap>();
     randomMaps = new List<RandomDungeonMap>();
     Name = "";
     ScriptList = new ListPair<int, string>();
 }
 public StoryCollection(int maxStories)
 {
     if (maxStories == 0)
         maxStories = 50;
     this.maxStories = maxStories;
     stories = new ListPair<int, Story>();
 }
Exemple #15
0
 public Inventory(ListPair <int, DataManager.Characters.InventoryItem> loadedInventory)
 {
     items = new ListPair <int, InventoryItem>();
     for (int i = 0; i < loadedInventory.Count; i++)
     {
         items.Add(loadedInventory.KeyByIndex(i), new InventoryItem(loadedInventory.ValueByIndex(i)));
     }
 }
Exemple #16
0
 public MoveCollection(int maxMoves)
 {
     if (maxMoves == 0)
     {
         maxMoves = 50;
     }
     this.maxMoves = maxMoves;
     moves         = new ListPair <int, Move>();
 }
Exemple #17
0
 public ShopCollection(int maxShops)
 {
     if (maxShops == 0)
     {
         maxShops = 50;
     }
     this.maxShops = maxShops;
     shops         = new ListPair <int, Shop>();
 }
Exemple #18
0
 public NpcCollection(int maxNpcs)
 {
     if (maxNpcs == 0)
     {
         maxNpcs = 50;
     }
     this.maxNpcs = maxNpcs;
     npcs         = new ListPair <int, Npc>();
 }
Exemple #19
0
 public ItemCollection(int maxItems)
 {
     if (maxItems == 0)
     {
         maxItems = 50;
     }
     this.maxItems = maxItems;
     items         = new ListPair <int, Item>();
 }
 public StoryCollection(int maxStories)
 {
     if (maxStories == 0)
     {
         maxStories = 50;
     }
     this.maxStories = maxStories;
     stories         = new ListPair <int, Story>();
 }
Exemple #21
0
        public void LoadFromSegmentData(ListPair <string, string> parameters)
        {
            this.parameters = parameters;



            Load(parameters.GetValue("ID"), parameters.GetValue("X").ToInt(), parameters.GetValue("Y").ToInt(),
                 parameters.GetValue("Speed").ToInt(), parameters.GetValue("Pause").ToBool());
        }
Exemple #22
0
 public EvolutionCollection(int maxEvos)
 {
     if (maxEvos == 0)
     {
         maxEvos = 50;
     }
     this.maxEvos = maxEvos;
     evolutions   = new ListPair <int, Evolution>();
 }
 public MapCollection(int maxMaps)
 {
     if (maxMaps == 0)
     {
         maxMaps = 50;
     }
     this.maxMaps = maxMaps;
     maps         = new ListPair <int, Map>();
 }
Exemple #24
0
    static IEnumerable <bool> makeList(object First, object Second, object List)
    {
        ListPair list1  = new ListPair(Second, Atom.NIL);
        ListPair result = new ListPair(First, list1);

        foreach (bool l1 in YP.unify(List, result))
        {
            yield return(false);
        }
    }
Exemple #25
0
        public static void GuildStepDown(Client client)
        {
            if (string.IsNullOrEmpty(client.Player.GuildName))
            {
                Messenger.PlayerMsg(client, "You are not in a guild.", Text.BrightRed);
                return;
            }
            bool stepDown = false;

            if (client.Player.GuildAccess > Enums.GuildRank.Member)
            {
                stepDown = true;
            }

            int index = -1;

            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players))
            {
                ListPair <string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                index = members.IndexOfKey(client.Player.CharID);

                if (stepDown)
                {
                    DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, members.KeyByIndex(index), (int)client.Player.GuildAccess - 1);
                    Messenger.PlayerMsg(client, "You have stepped down from your position in the guild.", Text.Blue);
                }
                else
                {
                    DataManager.Players.PlayerDataManager.RemoveGuildMember(dbConnection.Database, client.Player.CharID);
                    Messenger.PlayerMsg(client, "You have left your guild.", Text.Blue);
                }
            }

            if (stepDown)
            {
                client.Player.GuildAccess = (Enums.GuildRank)((int)client.Player.GuildAccess - 1);
            }
            else
            {
                client.Player.GuildName   = "";
                client.Player.GuildAccess = Enums.GuildRank.None;
            }
            //send the guild access data to all
            Messenger.SendPlayerGuild(client);

            //send the update to all possible guild members
            if (index > -1)
            {
                Messenger.SendFullGuildUpdate(client.Player.GuildName);
            }
        }
Exemple #26
0
 static bool hasAttack3(int X, int N, ListPair Arg3)
 {
     if (X == (int)YP.getValue(Arg3._arg1) + N || X == (int)YP.getValue(Arg3._arg1) - N)
     {
         return(true);
     }
     if (Arg3._arg2 is ListPair)
     {
         return(hasAttack3(X, N + 1, (ListPair)YP.getValue(Arg3._arg2)));
     }
     else
     {
         return(false);
     }
 }
Exemple #27
0
        public void LoadFromSegmentData(ListPair <string, string> parameters)
        {
            this.parameters = parameters;
            //this code never gets reached
            //if (parameters.Count > 4) {
            //    string[] choices = new string[data[4].ToInt()];
            //    int n = 5;
            //    for (int i = 0; i < choices.Length; i++) {
            //        choices[i] = data[n];

            //        n += 1;
            //    }
            //    Load(parameters.GetValue("Question"), parameters.GetValue("SegmentOnYes").ToInt(-1), parameters.GetValue("SegmentOnNo").ToInt(-1), parameters.GetValue("Mugshot").ToInt(-1), choices);
            //} else {
            Load(parameters.GetValue("Question"), parameters.GetValue("SegmentOnYes").ToInt(-1), parameters.GetValue("SegmentOnNo").ToInt(-1), parameters.GetValue("Mugshot").ToInt(-1), new string[] { "Yes", "No" });
            //}
        }
 public PlayerData(string charID)
 {
     this.CharID = charID;
     TeamMembers = new PlayerDataTeamMember[4];
     for (int i = 0; i < TeamMembers.Length; i++) {
         TeamMembers[i] = new PlayerDataTeamMember();
     }
     Friends = new PlayerFriendsList(charID);
     DungeonCompletionCounts = new ListPair<int, int>();
     RecruitList = new ListPair<int, byte>();
     Inventory = new ListPair<int, Characters.InventoryItem>();
     Bank = new ListPair<int, Characters.InventoryItem>();
     StoryChapters = new ListPair<int, bool>();
     JobList = new List<PlayerDataJobListItem>();
     MissionBoardMissions = new List<PlayerDataJobListItem>();
     StoryHelperStateSettings = new ListPair<string, string>();
     TriggerEvents = new List<PlayerDataTriggerEvent>();
     LastLogin = DateTime.MinValue;
     LastLogout = DateTime.MinValue;
     Email = "";
 }
Exemple #29
0
 public PlayerData(string charID)
 {
     this.CharID = charID;
     TeamMembers = new PlayerDataTeamMember[4];
     for (int i = 0; i < TeamMembers.Length; i++)
     {
         TeamMembers[i] = new PlayerDataTeamMember();
     }
     Friends = new PlayerFriendsList(charID);
     DungeonCompletionCounts = new ListPair <int, int>();
     RecruitList             = new ListPair <int, byte>();
     Inventory                = new ListPair <int, Characters.InventoryItem>();
     Bank                     = new ListPair <int, Characters.InventoryItem>();
     StoryChapters            = new ListPair <int, bool>();
     JobList                  = new List <PlayerDataJobListItem>();
     MissionBoardMissions     = new List <PlayerDataJobListItem>();
     StoryHelperStateSettings = new ListPair <string, string>();
     TriggerEvents            = new List <PlayerDataTriggerEvent>();
     LastLogin                = DateTime.MinValue;
     LastLogout               = DateTime.MinValue;
     Email                    = "";
 }
        private IEnumerable <Client> GetMapClients(ListPair <IMap, List <Client> > clientCollection, IMap map)
        {
            int mapIndex = clientCollection.IndexOfKey(map);

            if (mapIndex > -1)
            {
                List <Client> clients = clientCollection.ValueByIndex(mapIndex);
                foreach (Client client in clients)
                {
                    yield return(client);
                }
            }
            else
            {
                List <Client> clients = new List <Client>();
                foreach (Client client in map.GetClients())
                {
                    clients.Add(client);
                    yield return(client);
                }
                clientCollection.Add(map, clients);
            }
        }
Exemple #31
0
        static IEnumerable <bool> selectq(Variable X, ListPair Arg2, Variable Arg3)
        {
            foreach (bool l1 in X.unify(Arg2._arg1))
            {
                foreach (bool l2 in Arg3.unify(Arg2._arg2))
                {
                    yield return(false);
                }
            }

            ListPair Arg2Tail = YP.getValue(Arg2._arg2) as ListPair;

            if (Arg2Tail != null)
            {
                Variable Zs = new Variable();
                foreach (bool l1 in selectq(X, Arg2Tail, Zs))
                {
                    foreach (bool l2 in Arg3.unify(new ListPair(Arg2._arg1, Zs)))
                    {
                        yield return(false);
                    }
                }
            }
        }
Exemple #32
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     this.state      = (Enums.PadlockState)(parameters.GetValue("State").ToInt(0));
 }
Exemple #33
0
 /// <summary>
 /// Initializes this module
 /// </summary>
 public static void Initialize()
 {
     playerIDToTcpIDList = new ListPair<string, TcpClientIdentifier>();
 }
        public void BuildHitList(PacketHitList hitList)
        {
            this.hitList = hitList;

            ListPair <IMap, List <Client> > clientCollection       = new ListPair <IMap, List <Client> >();
            ListPair <IMap, Object[]>       borderingMapCollection = new ListPair <IMap, object[]>();

            for (int i = 0; i < hitListCache.Count; i++)
            {
                object[] param = hitListCache[i];
                switch ((PacketHitListTargets)param[0])
                {
                case PacketHitListTargets.Client:
                {
                    AddPacket((Client)param[1], (TcpPacket)param[2]);
                }
                break;

                case PacketHitListTargets.All:
                {
                    foreach (Client client in ClientManager.GetClients())
                    {
                        if (client.IsPlaying())
                        {
                            AddPacket(client, (TcpPacket)param[1]);
                        }
                    }
                }
                break;

                case PacketHitListTargets.RangedMapBut:
                {
                    Maps.IMap map    = param[2] as IMap;
                    int       range  = (int)param[6];
                    Client    client = param[1] as Client;
                    foreach (Client mapClient in GetMapClients(clientCollection, map))
                    {
                        if (mapClient != null && (client == null || mapClient.TcpID != client.TcpID))
                        {
                            if (range == -1 || PacketHitList.IsInRange(range, (int)param[4], (int)param[5], mapClient.Player.X, mapClient.Player.Y))
                            {
                                AddPacket(mapClient, (TcpPacket)param[3]);
                            }
                        }
                    }
                }
                break;
                // TODO: Should be fixed... (PacketHitListCache)
                //case PacketHitListTargets.PlayersInSightBut: {
                //        Client sender = param[1] as Client;
                //        IMap centralMap = param[2] as IMap;
                //        int range = (int)param[6];
                //        foreach (Client mapClient in centralMap.GetSurroundingClients(centralMap)) {
                //            if (sender == null || sender != mapClient) {
                //                if (range == -1 || SeamlessWorldHelper.IsInSight(centralMap, (int)param[4], (int)param[5], mapClient.Player.Map, mapClient.Player.X, mapClient.Player.Y)) {
                //                    AddPacket(mapClient, (TcpPacket)param[3]);
                //                }
                //            }
                //        }
                //    }
                //    break;

                case PacketHitListTargets.Party:
                {
                    Party party = param[1] as Party;
                    foreach (Client partyClient in party.GetOnlineMemberClients())
                    {
                        if (partyClient.IsPlaying())
                        {
                            AddPacket(partyClient, (TcpPacket)param[2]);
                        }
                    }
                }
                break;

                    // TODO: Should be fixed... (PacketHitListCache)
                    //case PacketHitListTargets.Others: {
                    //        Combat.ICharacter source = param[1] as Combat.ICharacter;
                    //        IMap map = param[2] as IMap;
                    //        TcpPacket packet = param[3] as TcpPacket;
                    //        Enums.OutdateType updateType = (Enums.OutdateType)param[4];
                    //        foreach (IMap borderingMap in GetBorderingMaps(borderingMapCollection, map)) {
                    //            foreach (Client borderingMapClient in GetMapClients(clientCollection, borderingMap)) {
                    //                if (borderingMapClient.Player.GetActiveRecruit() != source) {
                    //                    if (AI.MovementProcessor.WillCharacterSeeCharacter(borderingMap, borderingMapClient.Player.GetActiveRecruit(), map, source)) {
                    //                        if (!borderingMapClient.Player.IsSeenCharacterSeen(source)) {
                    //                            borderingMapClient.Player.AddActivation(hitList, source);
                    //                        }
                    //                        this.AddPacket(borderingMapClient, packet);
                    //                    } else {
                    //                        if (updateType == Enums.OutdateType.Location && borderingMapClient.Player.IsSeenCharacterSeen(source)) {
                    //                            this.AddPacket(borderingMapClient, packet);
                    //                            //unsee character
                    //                            borderingMapClient.Player.RemoveUnseenCharacters();
                    //                        } else {
                    //                            borderingMapClient.Player.OutdateCharacter(source, updateType);
                    //                            //outdate character
                    //                            //}
                    //                            //} else {
                    //                            //outdate character
                    //                        }
                    //                    }
                    //                }
                    //            }
                    //        }
                    //    }
                    //    break;
                }
            }

            hitListCache.Clear();
        }
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     this.file       = parameters.GetValue("File");
 }
Exemple #36
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     this.state = (Enums.PadlockState)(parameters.GetValue("State").ToInt(0));
 }
Exemple #37
0
 public ZoneCollection()
 {
     zones = new ListPair <int, Zone>();
 }
Exemple #38
0
        public void SaveCharacterData(DatabaseConnection dbConnection)
        {
            if (loaded && !SavingLocked) {
                dataLock.EnterWriteLock();

                try {
                    if (playerData.AvailableModules == null) {
                        playerData.AvailableModules = "";
                    }
                    PlayerDataManager.SavePlayerAvailableExpKitModules(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerCharacteristics(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerGuild(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerItemGenerals(dbConnection.Database, playerData);
                    JobList.SaveJobList(dbConnection);
                    //PlayerDataManager.SavePlayerJobList(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerLocation(dbConnection.Database, playerData);
                    //PlayerDataManager.SavePlayerMissionBoardGenerals(dbConnection.Database, playerData);
                    missionBoard.SaveMissionBoardData();
                    PlayerDataManager.SavePlayerMissionBoardMissions(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerMissionGenerals(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerStoryGenerals(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerStoryHelperStateSettings(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerStatistics(dbConnection.Database, playerData);

                    // Save inventory
                    ListPair<int, Characters.InventoryItem> updatedInventory = new ListPair<int, Characters.InventoryItem>();
                    for (int i = 1; i <= Inventory.Count; i++) {
                        if (Inventory[i].Updated) {
                            updatedInventory.Add(i, Inventory[i].BaseInventoryItem);
                            Inventory[i].Updated = false;
                        }
                    }
                    PlayerDataManager.SavePlayerInventoryUpdates(dbConnection.Database, CharID, updatedInventory);

                    // Save bank
                    ListPair<int, Characters.InventoryItem> updatedBank = new ListPair<int, Characters.InventoryItem>();
                    for (int i = 1; i <= Bank.Count; i++) {
                        if (Bank[i].Updated) {
                            updatedBank.Add(i, Bank[i].BaseInventoryItem);
                            Bank[i].Updated = false;
                        }
                    }

                    PlayerDataManager.SavePlayerBankUpdates(dbConnection.Database, CharID, updatedBank);

                    // Save trigger events
                    playerData.TriggerEvents.Clear();
                    for (int i = 0; i < triggerEvents.Count; i++) {
                        PlayerDataTriggerEvent triggerEvent = new PlayerDataTriggerEvent();
                        triggerEvents[i].Save(triggerEvent);
                        playerData.TriggerEvents.Add(triggerEvent);
                    }
                    PlayerDataManager.SavePlayerTriggerEvents(dbConnection.Database, playerData);

                    // Save team
                    for (int i = 0; i < team.Length; i++) {
                        playerData.TeamMembers[i].RecruitIndex = team[i].RecruitIndex;
                        playerData.TeamMembers[i].UsingTempStats = team[i].InTempMode;
                        if (team[i].Loaded) {
                            team[i].Save(dbConnection);
                        }
                    }
                    PlayerDataManager.SavePlayerTeam(dbConnection.Database, playerData);

                    IMap map = GetCurrentMap();
                    if (map != null && (map.MapType == Enums.MapType.Instanced || map.MapType == Enums.MapType.RDungeonMap || map.MapType == Enums.MapType.House)) {
                        map.Save();
                        //mInstancedMapManager.SaveActiveMap();
                    }
                    lock (mapsToDelete) {
                        AI.AIProcessor.mapGC.AddMaps(mapsToDelete);
                        mapsToDelete.Clear();
                    }
                } catch (Exception ex) {
                    System.Windows.Forms.MessageBox.Show("Map: " + MapID + System.Environment.NewLine + ex.ToString());
                } finally {
                    dataLock.ExitWriteLock();
                }
            }
        }
Exemple #39
0
        public void LoadFromSegmentData(ListPair<string, string> parameters)
        {
            this.parameters = parameters;
            //this code never gets reached
            //if (parameters.Count > 4) {
            //    string[] choices = new string[data[4].ToInt()];
            //    int n = 5;
            //    for (int i = 0; i < choices.Length; i++) {
            //        choices[i] = data[n];

            //        n += 1;
            //    }
            //    Load(parameters.GetValue("Question"), parameters.GetValue("SegmentOnYes").ToInt(-1), parameters.GetValue("SegmentOnNo").ToInt(-1), parameters.GetValue("Mugshot").ToInt(-1), choices);
            //} else {
                Load(parameters.GetValue("Question"), parameters.GetValue("SegmentOnYes").ToInt(-1), parameters.GetValue("SegmentOnNo").ToInt(-1), parameters.GetValue("Mugshot").ToInt(-1), new string[] { "Yes", "No" });
            //}
        }
Exemple #40
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
 }
Exemple #41
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("File"), parameters.GetValue("HonorSettings").ToBool(), parameters.GetValue("Loop").ToBool());
 }
Exemple #42
0
        public void BuildHitList(PacketHitList hitList)
        {
            this.hitList = hitList;

            ListPair<IMap, List<Client>> clientCollection = new ListPair<IMap, List<Client>>();
            ListPair<IMap, Object[]> borderingMapCollection = new ListPair<IMap, object[]>();

            for (int i = 0; i < hitListCache.Count; i++) {
                object[] param = hitListCache[i];
                switch ((PacketHitListTargets)param[0]) {

                    case PacketHitListTargets.Client: {
                            AddPacket((Client)param[1], (TcpPacket)param[2]);
                        }
                        break;

                    case PacketHitListTargets.All: {
                            foreach (Client client in ClientManager.GetClients()) {
                                if (client.IsPlaying()) {
                                    AddPacket(client, (TcpPacket)param[1]);
                                }
                            }
                        }
                        break;

                    case PacketHitListTargets.RangedMapBut: {
                            Maps.IMap map = param[2] as IMap;
                            int range = (int)param[6];
                            Client client = param[1] as Client;
                            foreach (Client mapClient in GetMapClients(clientCollection, map)) {
                                if (mapClient != null && (client == null || mapClient.TcpID != client.TcpID)) {
                                    if (range == -1 || PacketHitList.IsInRange(range, (int)param[4], (int)param[5], mapClient.Player.X, mapClient.Player.Y)) {
                                        AddPacket(mapClient, (TcpPacket)param[3]);
                                    }
                                }
                            }
                        }
                        break;
                    // TODO: Should be fixed... (PacketHitListCache)
                    //case PacketHitListTargets.PlayersInSightBut: {
                    //        Client sender = param[1] as Client;
                    //        IMap centralMap = param[2] as IMap;
                    //        int range = (int)param[6];
                    //        foreach (Client mapClient in centralMap.GetSurroundingClients(centralMap)) {
                    //            if (sender == null || sender != mapClient) {
                    //                if (range == -1 || SeamlessWorldHelper.IsInSight(centralMap, (int)param[4], (int)param[5], mapClient.Player.Map, mapClient.Player.X, mapClient.Player.Y)) {
                    //                    AddPacket(mapClient, (TcpPacket)param[3]);
                    //                }
                    //            }
                    //        }
                    //    }
                    //    break;

                    case PacketHitListTargets.Party: {
                            Party party = param[1] as Party;
                            foreach (Client partyClient in party.GetOnlineMemberClients()) {
                                if (partyClient.IsPlaying()) {
                                    AddPacket(partyClient, (TcpPacket)param[2]);
                                }
                            }
                        }
                        break;

                    // TODO: Should be fixed... (PacketHitListCache)
                    //case PacketHitListTargets.Others: {
                    //        Combat.ICharacter source = param[1] as Combat.ICharacter;
                    //        IMap map = param[2] as IMap;
                    //        TcpPacket packet = param[3] as TcpPacket;
                    //        Enums.OutdateType updateType = (Enums.OutdateType)param[4];
                    //        foreach (IMap borderingMap in GetBorderingMaps(borderingMapCollection, map)) {
                    //            foreach (Client borderingMapClient in GetMapClients(clientCollection, borderingMap)) {
                    //                if (borderingMapClient.Player.GetActiveRecruit() != source) {
                    //                    if (AI.MovementProcessor.WillCharacterSeeCharacter(borderingMap, borderingMapClient.Player.GetActiveRecruit(), map, source)) {
                    //                        if (!borderingMapClient.Player.IsSeenCharacterSeen(source)) {
                    //                            borderingMapClient.Player.AddActivation(hitList, source);
                    //                        }
                    //                        this.AddPacket(borderingMapClient, packet);
                    //                    } else {
                    //                        if (updateType == Enums.OutdateType.Location && borderingMapClient.Player.IsSeenCharacterSeen(source)) {
                    //                            this.AddPacket(borderingMapClient, packet);
                    //                            //unsee character
                    //                            borderingMapClient.Player.RemoveUnseenCharacters();
                    //                        } else {
                    //                            borderingMapClient.Player.OutdateCharacter(source, updateType);
                    //                            //outdate character
                    //                            //}
                    //                            //} else {
                    //                            //outdate character
                    //                        }
                    //                    }
                    //                }
                    //            }
                    //        }
                    //    }
                    //    break;

                }
            }

            hitListCache.Clear();
        }
Exemple #43
0
 private IEnumerable<Client> GetMapClients(ListPair<IMap, List<Client>> clientCollection, IMap map)
 {
     int mapIndex = clientCollection.IndexOfKey(map);
     if (mapIndex > -1) {
         List<Client> clients = clientCollection.ValueByIndex(mapIndex);
         foreach (Client client in clients) {
             yield return client;
         }
     } else {
         List<Client> clients = new List<Client>();
         foreach (Client client in map.GetClients()) {
             clients.Add(client);
             yield return client;
         }
         clientCollection.Add(map, clients);
     }
 }
Exemple #44
0
 private IEnumerable<IMap> GetBorderingMaps(ListPair<IMap, Object[]> borderingMapCollection, IMap centralMap)
 {
     int mapIndex = borderingMapCollection.IndexOfKey(centralMap);
     if (mapIndex > -1) {
         Object[] maps = borderingMapCollection.ValueByIndex(mapIndex);
         foreach (IMap map in maps) {
             if (map != null) {
                 yield return map;
             }
         }
     } else {
         Object[] maps = new object[9];
         for (int borderingMapID = 0; borderingMapID < 9; borderingMapID++) {
             if (MapManager.IsBorderingMapLoaded(centralMap, (Enums.MapID)borderingMapID)) {
                 IMap borderingMap = MapManager.RetrieveBorderingMap(centralMap, (Enums.MapID)borderingMapID, true);
                 if (borderingMap != null) {
                     maps[borderingMapID] = borderingMap;
                     yield return borderingMap;
                 }
             }
         }
         borderingMapCollection.Add(centralMap, maps);
     }
 }
Exemple #45
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("Segment").ToInt());
 }
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("Segment").ToInt());
 }
 public DungeonCollection()
 {
     dungeons = new ListPair<int, Dungeon>();
 }
Exemple #48
0
        public void LoadShop(string[] parse)
        {
            pnlShopList.Visible = false;
            pnlShopEditor.Visible = true;
            this.Size = new System.Drawing.Size(pnlShopEditor.Width, pnlShopEditor.Height);

            txtName.Text = parse[2];
            txtJoinSay.Text = parse[3];
            txtLeaveSay.Text = parse[4];

            shopItemList = new ListPair<int, Client.Logic.Shops.ShopItem>();

            for (int i = 0; i < MaxInfo.MAX_TRADES; i++) {
                Shops.ShopItem shopItem = new Shops.ShopItem();
                shopItem.GiveItem = parse[5 + i * 3].ToInt();
                shopItem.GiveValue = parse[6 + i * 3].ToInt();
                shopItem.GetItem = parse[7 + i * 3].ToInt();

                shopItemList.Add(i, shopItem);
            }

            //if (lbxShopItems.SelectedItems.Count > 0) {

            //lbxShopItems.SelectItem(lbxShopItems.SelectedItems[0].TextIdentifier);

            //}

            RefreshShopItemList();
            lbxShopItems.SelectItem(0);

            btnEdit.Text = "Edit";
        }
Exemple #49
0
 public StorySegment()
 {
     parameters = new ListPair <string, string>();
 }
Exemple #50
0
 public EditableDungeon()
 {
     StandardMaps = new List<EditableStandardDungeonMap>();
     RandomMaps = new List<EditableRandomDungeonMap>();
     ScriptList = new ListPair<int, string>();
 }
Exemple #51
0
        public void SaveCharacterData(DatabaseConnection dbConnection)
        {
            if (loaded && !SavingLocked)
            {
                dataLock.EnterWriteLock();

                try {
                    if (playerData.AvailableModules == null)
                    {
                        playerData.AvailableModules = "";
                    }
                    PlayerDataManager.SavePlayerAvailableExpKitModules(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerCharacteristics(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerGuild(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerItemGenerals(dbConnection.Database, playerData);
                    JobList.SaveJobList(dbConnection);
                    //PlayerDataManager.SavePlayerJobList(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerLocation(dbConnection.Database, playerData);
                    //PlayerDataManager.SavePlayerMissionBoardGenerals(dbConnection.Database, playerData);
                    missionBoard.SaveMissionBoardData();
                    PlayerDataManager.SavePlayerMissionBoardMissions(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerMissionGenerals(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerStoryGenerals(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerStoryHelperStateSettings(dbConnection.Database, playerData);
                    PlayerDataManager.SavePlayerStatistics(dbConnection.Database, playerData);

                    // Save inventory
                    ListPair <int, Characters.InventoryItem> updatedInventory = new ListPair <int, Characters.InventoryItem>();
                    for (int i = 1; i <= Inventory.Count; i++)
                    {
                        if (Inventory[i].Updated)
                        {
                            updatedInventory.Add(i, Inventory[i].BaseInventoryItem);
                            Inventory[i].Updated = false;
                        }
                    }
                    PlayerDataManager.SavePlayerInventoryUpdates(dbConnection.Database, CharID, updatedInventory);

                    // Save bank
                    ListPair <int, Characters.InventoryItem> updatedBank = new ListPair <int, Characters.InventoryItem>();
                    for (int i = 1; i <= Bank.Count; i++)
                    {
                        if (Bank[i].Updated)
                        {
                            updatedBank.Add(i, Bank[i].BaseInventoryItem);
                            Bank[i].Updated = false;
                        }
                    }

                    PlayerDataManager.SavePlayerBankUpdates(dbConnection.Database, CharID, updatedBank);

                    // Save trigger events
                    playerData.TriggerEvents.Clear();
                    for (int i = 0; i < triggerEvents.Count; i++)
                    {
                        PlayerDataTriggerEvent triggerEvent = new PlayerDataTriggerEvent();
                        triggerEvents[i].Save(triggerEvent);
                        playerData.TriggerEvents.Add(triggerEvent);
                    }
                    PlayerDataManager.SavePlayerTriggerEvents(dbConnection.Database, playerData);

                    // Save team
                    for (int i = 0; i < team.Length; i++)
                    {
                        playerData.TeamMembers[i].RecruitIndex   = team[i].RecruitIndex;
                        playerData.TeamMembers[i].UsingTempStats = team[i].InTempMode;
                        if (team[i].Loaded)
                        {
                            team[i].Save(dbConnection);
                        }
                    }
                    PlayerDataManager.SavePlayerTeam(dbConnection.Database, playerData);

                    IMap map = GetCurrentMap();
                    if (map != null && (map.MapType == Enums.MapType.Instanced || map.MapType == Enums.MapType.RDungeonMap || map.MapType == Enums.MapType.House))
                    {
                        map.Save();
                        //mInstancedMapManager.SaveActiveMap();
                    }
                    lock (mapsToDelete) {
                        AI.AIProcessor.mapGC.AddMaps(mapsToDelete);
                        mapsToDelete.Clear();
                    }
                } catch (Exception ex) {
                    System.Windows.Forms.MessageBox.Show("Map: " + MapID + System.Environment.NewLine + ex.ToString());
                } finally {
                    dataLock.ExitWriteLock();
                }
            }
        }
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     this.file = parameters.GetValue("File");
 }
Exemple #53
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("File"), parameters.GetValue("HonorSettings").ToBool(), parameters.GetValue("Loop").ToBool());
 }
Exemple #54
0
 public static void Initialize()
 {
     AITypes = new ListPair<string, Type>();
     AIInstances = new ListPair<string, IAICore>();
     NPCAIType = new ListPair<string, string>();
 }
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("ID"), (Enums.Direction)parameters.GetValue("Direction").ToInt());
 }
Exemple #56
0
 public static void Initialize()
 {
     parties = new ListPair <string, Party>();
 }
Exemple #57
0
 //public ListPair<string, IPlayer> Players {
 //    get { return players; }
 //}
 public PlayerCollection()
 {
     players = new ListPair<string, IPlayer>();
 }
Exemple #58
0
        public PacketHitList()
        {
            HitList = new ListPair<Client, PacketList>();

            CachingEnabled = false; //Globals.PacketCaching;
        }
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     this.length = parameters.GetValue("Length").ToInt(0);
 }
Exemple #60
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("File"), parameters.GetValue("ImageID"), parameters.GetValue("X").ToInt(), parameters.GetValue("Y").ToInt());
 }