コード例 #1
0
        public static void smethod_20(Session session_0, ClientMessage clientMessage_0)
        {
            uint          itemId            = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actorByReferenceId = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                if (actorByReferenceId != null)
                {
                    CharacterInfo referenceObject = (CharacterInfo)actorByReferenceId.ReferenceObject;
                    try
                    {
                        ContestItem item = instanceBySpaceId.Items[itemId];
                        if ((item != null) && item.IsActive)
                        {
                            using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                            {
                                item.CatchItem(client, (int)session_0.CharacterId);
                                string definitionName = item.DefinitionName;
                                if (definitionName != null)
                                {
                                    if (definitionName != "cofre_oro")
                                    {
                                        if (!(definitionName == "cofre_plata"))
                                        {
                                            if (definitionName == "")
                                            {
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, actorByReferenceId.Name + " ha cogido un diamante.", false, 3);
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, actorByReferenceId.Name + " has caught a diamond", false, 3);
                                            }
                                            else
                                            {
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " ha atrapado un cofre y obtiene: ", item.SilverCredits, " monedas de plata." }), false, 3);
                                                instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " has caught a chest and obtained: ", item.GoldCredits, " silver credits." }), false, 3);
                                                referenceObject.UpdateSilverCreditsBalance(client, (int)item.SilverCredits);
                                                session_0.SendData(CharacterCoinsComposer.AddSilverCompose(item.SilverCredits), false);
                                            }
                                        }
                                        else
                                        {
                                            instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " ha atrapado un cofre y obtiene: ", item.GoldCredits, " monedas de oro." }), false, 3);
                                            instanceBySpaceId.BroadcastChatMessage(actorByReferenceId, string.Concat(new object[] { actorByReferenceId.Name, " has caught a chest and obtained: ", item.GoldCredits, " gold credits." }), false, 3);
                                            referenceObject.UpdateGoldCreditsBalance(client, (int)item.GoldCredits);
                                            session_0.SendData(CharacterCoinsComposer.AddGoldCompose(item.GoldCredits), false);
                                        }
                                    }
                                }
                                instanceBySpaceId.BroadcastMessage(SpaceCatchItemComposer.Compose(itemId), 0, false);
                                instanceBySpaceId.BroadcastMessage(SpaceRemoveItemComposer.Compose(itemId), 0, false);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }