コード例 #1
0
ファイル: Inventory.cs プロジェクト: pzaps/Server
 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)));
     }
 }
コード例 #2
0
 public ShopCollection(int maxShops)
 {
     if (maxShops == 0)
         maxShops = 50;
     this.maxShops = maxShops;
     shops = new ListPair<int, Shop>();
 }
コード例 #3
0
ファイル: MoveCollection.cs プロジェクト: pzaps/Server
 public MoveCollection(int maxMoves)
 {
     if (maxMoves == 0)
         maxMoves = 50;
     this.maxMoves = maxMoves;
     moves = new ListPair<int, Move>();
 }
コード例 #4
0
ファイル: EvolutionCollection.cs プロジェクト: pzaps/Server
 public EvolutionCollection(int maxEvos)
 {
     if (maxEvos == 0)
         maxEvos = 50;
     this.maxEvos = maxEvos;
     evolutions = new ListPair<int,Evolution>();
 }
コード例 #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";
        }
コード例 #6
0
 public Dungeon()
 {
     standardMaps = new List <StandardDungeonMap>();
     randomMaps   = new List <RandomDungeonMap>();
     Name         = "";
     ScriptList   = new ListPair <int, string>();
 }
コード例 #7
0
ファイル: NpcCollection.cs プロジェクト: pzaps/Server
 public NpcCollection(int maxNpcs)
 {
     if (maxNpcs == 0)
         maxNpcs = 50;
     this.maxNpcs = maxNpcs;
     npcs = new ListPair<int, Npc>();
 }
コード例 #8
0
ファイル: Queens.cs プロジェクト: MatiasNAmendola/YieldProlog
        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);
                }
            }
        }
コード例 #9
0
 public ItemCollection(int maxItems)
 {
     if (maxItems == 0)
         maxItems = 50;
     this.maxItems = maxItems;
     items = new ListPair<int, Item>();
 }
コード例 #10
0
 public MapCollection(int maxMaps)
 {
     if (maxMaps == 0)
         maxMaps = 50;
     this.maxMaps = maxMaps;
     maps = new ListPair<int, Map>();
 }
コード例 #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);
 }
コード例 #12
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);
            }
        }
コード例 #13
0
ファイル: Dungeon.cs プロジェクト: pzaps/Server
 public Dungeon()
 {
     standardMaps = new List<StandardDungeonMap>();
     randomMaps = new List<RandomDungeonMap>();
     Name = "";
     ScriptList = new ListPair<int, string>();
 }
コード例 #14
0
 public StoryCollection(int maxStories)
 {
     if (maxStories == 0)
         maxStories = 50;
     this.maxStories = maxStories;
     stories = new ListPair<int, Story>();
 }
コード例 #15
0
ファイル: Inventory.cs プロジェクト: blastboy/Server
 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)));
     }
 }
コード例 #16
0
 public MoveCollection(int maxMoves)
 {
     if (maxMoves == 0)
     {
         maxMoves = 50;
     }
     this.maxMoves = maxMoves;
     moves         = new ListPair <int, Move>();
 }
コード例 #17
0
ファイル: ShopCollection.cs プロジェクト: blastboy/Server
 public ShopCollection(int maxShops)
 {
     if (maxShops == 0)
     {
         maxShops = 50;
     }
     this.maxShops = maxShops;
     shops         = new ListPair <int, Shop>();
 }
コード例 #18
0
ファイル: NpcCollection.cs プロジェクト: SupaFresh/Server
 public NpcCollection(int maxNpcs)
 {
     if (maxNpcs == 0)
     {
         maxNpcs = 50;
     }
     this.maxNpcs = maxNpcs;
     npcs         = new ListPair <int, Npc>();
 }
コード例 #19
0
ファイル: ItemCollection.cs プロジェクト: SupaFresh/Server
 public ItemCollection(int maxItems)
 {
     if (maxItems == 0)
     {
         maxItems = 50;
     }
     this.maxItems = maxItems;
     items         = new ListPair <int, Item>();
 }
コード例 #20
0
 public StoryCollection(int maxStories)
 {
     if (maxStories == 0)
     {
         maxStories = 50;
     }
     this.maxStories = maxStories;
     stories         = new ListPair <int, Story>();
 }
コード例 #21
0
ファイル: MoveFNPCSegment.cs プロジェクト: pmdcp/Client
        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());
        }
コード例 #22
0
 public EvolutionCollection(int maxEvos)
 {
     if (maxEvos == 0)
     {
         maxEvos = 50;
     }
     this.maxEvos = maxEvos;
     evolutions   = new ListPair <int, Evolution>();
 }
コード例 #23
0
 public MapCollection(int maxMaps)
 {
     if (maxMaps == 0)
     {
         maxMaps = 50;
     }
     this.maxMaps = maxMaps;
     maps         = new ListPair <int, Map>();
 }
コード例 #24
0
ファイル: Tutorial3.cs プロジェクト: wannaphong/YieldProlog
    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);
        }
    }
コード例 #25
0
ファイル: GuildManager.cs プロジェクト: SupaFresh/Server
        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);
            }
        }
コード例 #26
0
ファイル: Queens.cs プロジェクト: MatiasNAmendola/YieldProlog
 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);
     }
 }
コード例 #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" });
            //}
        }
コード例 #28
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 = "";
 }
コード例 #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                    = "";
 }
コード例 #30
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);
            }
        }
コード例 #31
0
ファイル: Queens.cs プロジェクト: MatiasNAmendola/YieldProlog
        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);
                    }
                }
            }
        }
コード例 #32
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     this.state      = (Enums.PadlockState)(parameters.GetValue("State").ToInt(0));
 }
コード例 #33
0
ファイル: PlayerID.cs プロジェクト: pzaps/Server
 /// <summary>
 /// Initializes this module
 /// </summary>
 public static void Initialize()
 {
     playerIDToTcpIDList = new ListPair<string, TcpClientIdentifier>();
 }
コード例 #34
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();
        }
コード例 #35
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     this.file       = parameters.GetValue("File");
 }
コード例 #36
0
ファイル: PadlockSegment.cs プロジェクト: blastboy/Client
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     this.state = (Enums.PadlockState)(parameters.GetValue("State").ToInt(0));
 }
コード例 #37
0
 public ZoneCollection()
 {
     zones = new ListPair <int, Zone>();
 }
コード例 #38
0
ファイル: PlayerDB.Data.cs プロジェクト: pzaps/Server
        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();
                }
            }
        }
コード例 #39
0
ファイル: AskQuestionSegment.cs プロジェクト: blastboy/Client
        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" });
            //}
        }
コード例 #40
0
ファイル: HidePlayersSegment.cs プロジェクト: blastboy/Client
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
 }
コード例 #41
0
ファイル: PlayMusicSegment.cs プロジェクト: blastboy/Client
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("File"), parameters.GetValue("HonorSettings").ToBool(), parameters.GetValue("Loop").ToBool());
 }
コード例 #42
0
ファイル: PacketHitListCache.cs プロジェクト: pzaps/Server
        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();
        }
コード例 #43
0
ファイル: PacketHitListCache.cs プロジェクト: pzaps/Server
 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);
     }
 }
コード例 #44
0
ファイル: PacketHitListCache.cs プロジェクト: pzaps/Server
 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);
     }
 }
コード例 #45
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("Segment").ToInt());
 }
コード例 #46
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("Segment").ToInt());
 }
コード例 #47
0
 public DungeonCollection()
 {
     dungeons = new ListPair<int, Dungeon>();
 }
コード例 #48
0
ファイル: winShopPanel.cs プロジェクト: blastboy/Client
        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";
        }
コード例 #49
0
 public StorySegment()
 {
     parameters = new ListPair <string, string>();
 }
コード例 #50
0
ファイル: EditableDungeon.cs プロジェクト: blastboy/Client
 public EditableDungeon()
 {
     StandardMaps = new List<EditableStandardDungeonMap>();
     RandomMaps = new List<EditableRandomDungeonMap>();
     ScriptList = new ListPair<int, string>();
 }
コード例 #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();
                }
            }
        }
コード例 #52
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     this.file = parameters.GetValue("File");
 }
コード例 #53
0
 public void LoadFromSegmentData(ListPair <string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("File"), parameters.GetValue("HonorSettings").ToBool(), parameters.GetValue("Loop").ToBool());
 }
コード例 #54
0
ファイル: ScriptManager.cs プロジェクト: pzaps/Server
 public static void Initialize()
 {
     AITypes = new ListPair<string, Type>();
     AIInstances = new ListPair<string, IAICore>();
     NPCAIType = new ListPair<string, string>();
 }
コード例 #55
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     Load(parameters.GetValue("ID"), (Enums.Direction)parameters.GetValue("Direction").ToInt());
 }
コード例 #56
0
 public static void Initialize()
 {
     parties = new ListPair <string, Party>();
 }
コード例 #57
0
ファイル: PlayerCollection.cs プロジェクト: blastboy/Client
 //public ListPair<string, IPlayer> Players {
 //    get { return players; }
 //}
 public PlayerCollection()
 {
     players = new ListPair<string, IPlayer>();
 }
コード例 #58
0
ファイル: PacketHitList.cs プロジェクト: pzaps/Server
        public PacketHitList()
        {
            HitList = new ListPair<Client, PacketList>();

            CachingEnabled = false; //Globals.PacketCaching;
        }
コード例 #59
0
 public void LoadFromSegmentData(ListPair<string, string> parameters)
 {
     this.parameters = parameters;
     this.length = parameters.GetValue("Length").ToInt(0);
 }
コード例 #60
0
ファイル: ShowImageSegment.cs プロジェクト: blastboy/Client
 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());
 }