Beispiel #1
0
        public void TakeLoot(Player plr)
        {
            Character character = CharMgr.GetCharacter(plr.CharacterId, false);

            var bagExists = LootBags.ContainsKey(character.CharacterId);

            if (bagExists)
            {
                var bag = LootBags[character.CharacterId];

                foreach (var talisman in bag.Value)
                {
                    // Adding bag to the player
                    ItemResult result = plr.ItmInterface.CreateItem(bag.Key, 1, bag.Value, 0, 0, false);

                    if (result == ItemResult.RESULT_OK)
                    {
                        LootBags.Remove(plr.CharacterId);
                    }
                    else if (result == ItemResult.RESULT_MAX_BAG)
                    {
                        plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_LOOT,
                                               Localized_text.TEXT_OVERAGE_CANT_LOOT);
                    }
                }

                //ItemResult result = plr.ItmInterface.CreateItem(bag.Key, 1, items.talisman,
                //    items.primary_dye, items.secondary_dye, false);
            }
        }
Beispiel #2
0
        //public void Scoreboard(ContributionInfo playerRoll, int preIndex, int postIndex)
        //{

        //    Player targPlayer = Player.GetPlayer(playerRoll.PlayerCharId);

        //    if (targPlayer == null)
        //        return;

        //    PacketOut Out = new PacketOut((byte)Opcodes.F_PQLOOT_TRIGGER, 1723);
        //    Out.WriteStringBytes(_publicQuestInfo.Name);
        //    Out.Fill(0, 24 - _publicQuestInfo.Name.Length);
        //    Out.WriteByte(_bags[gold]);  // gold
        //    Out.WriteByte(_bags[purple]);
        //    Out.WriteByte(_bags[blue]);
        //    Out.WriteByte(_bags[green]);
        //    Out.WriteByte(_bags[white]); // white
        //    Out.Fill(0, 3);

        //    WritePreRolls(Out);

        //    Out.WriteStringBytes(playerRoll.PlayerName);
        //    Out.Fill(0, 24 - playerRoll.PlayerName.Length);
        //    Out.Fill(0, 2);
        //    Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
        //    Out.WriteUInt16((ushort)(preIndex + 1)); // place

        //    WritePostRolls(Out);

        //    Out.WriteUInt16((ushort)(postIndex + 1)); // place
        //    Out.WriteStringBytes(playerRoll.PlayerName);
        //    Out.Fill(0, 24 - playerRoll.PlayerName.Length);
        //    Out.Fill(0, 2);
        //    Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
        //    Out.WriteByte(1);  // ???
        //    Out.WriteByte(playerRoll.BagWon);  // bag won

        //    Out.Fill(0, 2);
        //    //Out.WriteUInt16(TIME_PQ_RESET);
        //    Out.WriteByte(0);
        //    Out.WriteByte(3);


        //    Out.WriteByte(0);
        //    Out.WriteByte(0);
        //    Out.WriteByte(1);
        //    Out.Fill(0, 27);
        //    //
        //    // no clue yet seams to be if you didnt won anything you get that item


        //    /*
        //    Out.WritePacketString(@"|d4 c0 01 |...d............|
        //    |57 61 72 20 43 72 65 73 74 00 00 00 00 00 00 00 |War Crest.......|
        //    |00 00 00 00 00 00 00 00 00 00 00                |...........     |
        //    ");
        //    */

        //    targPlayer.SendPacket(Out);
        //    // Info.SendCurrentStage(plr);
        //}  //  d4 c0 01

        //public void PersonalScoreboard(ContributionInfo playerRoll, byte bagWon)
        //{
        //    Player targPlayer = Player.GetPlayer(playerRoll.PlayerCharId);

        //    if (targPlayer == null)
        //        return;

        //    PacketOut Out = new PacketOut((byte)Opcodes.F_PQLOOT_TRIGGER, 1723);
        //    Out.WriteStringBytes(_publicQuestInfo.Name);
        //    Out.Fill(0, 24 - _publicQuestInfo.Name.Length);
        //    Out.WriteByte(_bags[gold]);  // gold
        //    Out.WriteByte(_bags[purple]);
        //    Out.WriteByte(_bags[blue]);
        //    Out.WriteByte(_bags[green]);
        //    Out.WriteByte(_bags[white]); // white
        //    Out.Fill(0, 3);
        //    ContributionInfo curRoll = playerRoll;

        //    Out.WriteStringBytes(targPlayer.Name);
        //    Out.Fill(0, 24 - targPlayer.Name.Length);
        //    Out.Fill(0, 2);
        //    Out.WriteUInt16R((ushort)curRoll.RandomBonus);
        //    Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
        //    Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
        //    for (int i = 1; i < 24; i++)
        //        Out.Fill(0, 32);

        //    Out.WriteStringBytes(targPlayer.Name);
        //    Out.Fill(0, 24 - targPlayer.Name.Length);
        //    Out.Fill(0, 2);
        //    Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
        //    Out.WriteUInt16(1); // place
        //    Out.WriteStringBytes(targPlayer.Name);
        //    Out.Fill(0, 24 - targPlayer.Name.Length);
        //    Out.Fill(0, 2);
        //    Out.WriteUInt16R((ushort)curRoll.RandomBonus);
        //    Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
        //    Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
        //    Out.WriteByte(1);  // ???
        //    Out.WriteByte(curRoll.BagWon);  // bag won
        //    for (int i = 1; i < 24; i++)
        //        Out.Fill(0, 34);  // i just send empty once here

        //    Out.WriteUInt16(1); // place
        //    Out.WriteStringBytes(targPlayer.Name);
        //    Out.Fill(0, 24 - targPlayer.Name.Length);
        //    Out.Fill(0, 2);
        //    Out.WriteUInt16R((ushort)playerRoll.RandomBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.ContributionBonus);
        //    Out.WriteUInt16R((ushort)playerRoll.PersistenceBonus);
        //    Out.WriteByte(1);  // ???
        //    Out.WriteByte(playerRoll.BagWon);  // bag won

        //    Out.Fill(0, 2);
        //    //Out.WriteUInt16(TIME_PQ_RESET);
        //    Out.WriteByte(0);
        //    Out.WriteByte(3);


        //    Out.WriteByte(0);
        //    Out.WriteByte(0);
        //    Out.WriteByte(1);
        //    Out.Fill(0, 27);
        //    //
        //    // no clue yet seams to be if you didnt won anything you get that item


        //    /*
        //    Out.WritePacketString(@"|d4 c0 01 |...d............|
        //    |57 61 72 20 43 72 65 73 74 00 00 00 00 00 00 00 |War Crest.......|
        //    |00 00 00 00 00 00 00 00 00 00 00                |...........     |
        //    ");
        //    */
        //    targPlayer.SendPacket(Out);
        //    // Info.SendCurrentStage(plr);
        //}  //  d4 c0 01

        //private void WritePreRolls(PacketOut Out)
        //{
        //    int maxCount = Math.Min(24, _preRoll.Count);

        //    for (int i = 0; i < maxCount; i++)
        //    {
        //        ContributionInfo curRoll = _preRoll[i].Value;

        //        Out.WriteStringBytes(curRoll.PlayerName);
        //        Out.Fill(0, 24 - curRoll.PlayerName.Length);
        //        Out.Fill(0, 2);
        //        Out.WriteUInt16R((ushort)curRoll.RandomBonus);
        //        Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
        //        Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
        //    }

        //    if (maxCount < 24)
        //        for (int i = maxCount; i < 24; i++)
        //            Out.Fill(0, 32);
        //}

        //private void WritePersonalPreRolls(PacketOut Out)
        //{
        //    int maxCount = Math.Min(24, 1);

        //    for (int i = 0; i < maxCount; i++)
        //    {
        //        ContributionInfo curRoll = _preRoll[i].Value;

        //        Out.WriteStringBytes(curRoll.PlayerName);
        //        Out.Fill(0, 24 - curRoll.PlayerName.Length);
        //        Out.Fill(0, 2);
        //        Out.WriteUInt16R((ushort)curRoll.RandomBonus);
        //        Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
        //        Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
        //    }

        //    if (maxCount < 24)
        //        for (int i = maxCount; i < 24; i++)
        //            Out.Fill(0, 32);
        //}

        //private void WritePostRolls(PacketOut Out)
        //{
        //    int maxCount = Math.Min(24, _postRoll.Count);

        //    for (int i = 0; i < maxCount; i++)
        //    {
        //        ContributionInfo curRoll = _postRoll[i].Value;

        //        Out.WriteStringBytes(curRoll.PlayerName);
        //        Out.Fill(0, 24 - curRoll.PlayerName.Length);
        //        Out.Fill(0, 2);
        //        Out.WriteUInt16R((ushort)curRoll.RandomBonus);
        //        Out.WriteUInt16R((ushort)curRoll.ContributionBonus);
        //        Out.WriteUInt16R((ushort)curRoll.PersistenceBonus);
        //        Out.WriteByte(1);  // ???
        //        Out.WriteByte(curRoll.BagWon);  // bag won
        //    }

        //    if (maxCount < 24)
        //        for (int i = maxCount; i < 24; i++)
        //            Out.Fill(0, 34);  // i just send empty once here
        //}

        public void Add(uint characterId, KeyValuePair <Item_Info, List <Talisman> > generatedLootBag)
        {
            LootBags.Add(characterId, generatedLootBag);
        }