Ejemplo n.º 1
0
        private static void smethod_22(Session session_0, ClientMessage clientMessage_0)
        {
            uint          actorId           = clientMessage_0.ReadUnsignedInteger();
            uint          num2              = clientMessage_0.ReadUnsignedInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actor  = instanceBySpaceId.GetActor(actorId);
                SpaceActor actor2 = instanceBySpaceId.GetActor(num2);
                if ((actor != null) && (actor2 != null) && ChatCommands.block_coco == false)
                {
                    CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject;
                    CharacterInfo info2           = (CharacterInfo)actor2.ReferenceObject;
                    if (!actor2.IsLocked)
                    {
                        using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                        {
                            referenceObject.UpdateGoldCreditsBalance(client, -200);//Coconut cost 10
                            referenceObject.UpdateCoconuts(client, true);
                            info2.UpdateCoconuts(client, false);
                            session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(200), false);//Coconut cost 10
                            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 5), 0, false);
                            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 5), 0, false);
                            actor2.Lock(6, false, true);
                            instanceBySpaceId.BroadcastMessage(SpaceUserSendCoconut.SendAndBlock(actor2.ReferenceId), 0, false);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private static void smethod_21(Session session_0, ClientMessage clientMessage_0)
        {
            uint num2 = clientMessage_0.ReadUnsignedInteger();

            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actor  = instanceBySpaceId.GetActorByReferenceId(session_0.CharacterId, SpaceActorType.UserCharacter);
                SpaceActor actor2 = instanceBySpaceId.GetActor(num2);
                if ((actor != null) && (actor2 != null))
                {
                    CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject;
                    CharacterInfo info2           = (CharacterInfo)actor2.ReferenceObject;
                    if (!actor.IsLocked && !actor2.IsLocked)
                    {
                        actor.StopMoving();
                        using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                        {
                            referenceObject.UpdateGoldCreditsBalance(client, -250);
                            referenceObject.UpdateUppercuts(client, true);
                            info2.UpdateUppercuts(client, false);
                            session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(250));
                            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 4), 0, false);
                            instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 4), 0, false);
                            actor.Lock(20, true, false);
                            actor2.Lock(20, true, false);
                            instanceBySpaceId.BroadcastMessage(SpaceUserSendUppercut.Compose(actor, actor2), 0, false);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
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)
                    {
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private static void smethod_21(Session session_0, ClientMessage clientMessage_0)
        {
            clientMessage_0.ReadInteger();
            uint actorId = clientMessage_0.ReadUnsignedInteger();

            clientMessage_0.ReadInteger();
            clientMessage_0.ReadInteger();
            uint num2 = clientMessage_0.ReadUnsignedInteger();

            clientMessage_0.ReadInteger();
            clientMessage_0.ReadInteger();
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(session_0.CurrentSpaceId);

            if (instanceBySpaceId != null)
            {
                SpaceActor actor  = instanceBySpaceId.GetActor(actorId);
                SpaceActor actor2 = instanceBySpaceId.GetActor(num2);
                uint       ID1    = CharacterResolverCache.GetUidFromName(actor.Name);
                uint       ID2    = CharacterResolverCache.GetUidFromName(actor2.Name);
                if ((actor != null) && (actor2 != null))
                {
                    CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject;
                    CharacterInfo info2           = (CharacterInfo)actor2.ReferenceObject;
                    if (!actor.IsLocked && !actor2.IsLocked && ChatCommands.block_upper == false && !ChatCommands.UpperBlock.Contains(actor2.Name) && !ChatCommands.UpperBlockUser.Contains(ID1) && !ChatCommands.UpperBlockUser.Contains(ID2))
                    {
                        actor.StopMoving();
                        using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                        {
                            if (referenceObject.Staff == 1)
                            {
                                referenceObject.UpdateGoldCreditsBalance(client, -250);//Punch cost 500
                                referenceObject.UpdateUppercuts(client, true);
                                info2.UpdateUppercuts(client, false);
                                session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(250), false);//Punch cost 500
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 4), 0, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 4), 0, false);
                                actor.Lock(13, false, false);
                                actor2.Lock(10, true, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUserSendUppercut.Compose(actor, actor2), 0, false);
                            }
                            else
                            {
                                referenceObject.UpdateGoldCreditsBalance(client, -250);//Punch cost 200
                                referenceObject.UpdateUppercuts(client, true);
                                info2.UpdateUppercuts(client, false);
                                session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(250), false);//Punch cost 200
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor, 4), 0, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUpdateUserStatistics.Compose(actor2, 4), 0, false);
                                actor.Lock(13, false, false);
                                actor2.Lock(10, true, false);
                                instanceBySpaceId.BroadcastMessage(SpaceUserSendUppercut.Compose(actor, actor2), 0, false);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static void OnTimeLeftRequest(Session Session, ClientMessage Message)
        {
            CharacterInfo characterInfo = Session.CharacterInfo;

            if (characterInfo != null)
            {
                characterInfo.TimeSinceLastActivityPointsUpdate -= 100.0;
                if (characterInfo.TimeSinceLastActivityPointsUpdate > 0.0)
                {
                    Session.SendData(SilverCoinsTimeLeftComposer.Compose((int)characterInfo.TimeSinceLastActivityPointsUpdate));
                }
                else
                {
                    characterInfo.TimeSinceLastActivityPointsUpdate = 900.0;
                    Session.SendData(SilverCoinsTimeLeftComposer.Compose(900));
                    Session.SendData(CharacterCoinsComposer.AddSilverCompose(50));
                }
            }
        }
Ejemplo n.º 6
0
        public static bool HandleCommand(Session Session, string Input)
        {
            Input = Input.Substring(1, Input.Length - 1);
            string[]      input             = Input.Split(new char[] { ' ' });
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId);
            SpaceActor    actor             = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter);
            CharacterInfo referenceObject   = (CharacterInfo)actor.ReferenceObject;

            switch (input[0])
            {
            case "position":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Session.SendData(SpaceChatComposer.Compose(0, string.Concat(new object[] { "Tu posici\x00f3n actual es - X: ", actor.Position.Int32_0, ", Y: ", actor.Position.Int32_1, ", Z: ", actor.Position.Int32_2 }), 3, ChatType.Say), false);
                    return(true);
                }
                return(false);

            case "bm":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    if (!UpperBlock.Contains(actor.Name))
                    {
                        string str = string.Format("{0}: Has activated Block User Upper.", actor.Name);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false);
                        UpperBlock.Add(actor.Name);
                    }
                    return(true);
                }
                return(false);

            case "uub":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Input = Input.Replace("uub", "");
                    Input = Input.Replace(" ", "");

                    uint IDtoblock = CharacterResolverCache.GetUidFromName(Input);



                    if (!UpperBlockUser.Contains(IDtoblock))
                    {
                        string str = string.Format("{0}: Has activated Block User Upper For {1}", actor.Name, Input);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false);
                        UpperBlockUser.Add(IDtoblock);
                    }
                    return(true);
                }
                return(false);

            case "ub":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Input = Input.Replace("ub", "");
                    Input = Input.Replace(" ", "");

                    uint IDtoblock = CharacterResolverCache.GetUidFromName(Input);



                    if (UpperBlockUser.Contains(IDtoblock))
                    {
                        string str = string.Format("{0}: Has deactivated Block User Upper For {1}", actor.Name, Input);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false);
                        UpperBlockUser.Remove(IDtoblock);
                    }
                    return(true);
                }
                return(false);

            case "ubm":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    if (UpperBlock.Contains(actor.Name))
                    {
                        string str = string.Format("{0}: Has deactivated Block User Upper.", actor.Name);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false);
                        UpperBlock.Remove(actor.Name);
                    }
                    return(true);
                }
                return(false);


            case "block_upper":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha bloqueado el punch.", 3, ChatType.Say), 0, false);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Punch On.", 3, ChatType.Say), 0, false);
                    block_upper = true;
                    return(true);
                }
                return(false);

            case "unblock_upper":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha desbloqueado el punch.", 3, ChatType.Say), 0, false);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Punch Off.", 3, ChatType.Say), 0, false);
                    block_upper = false;
                    return(true);
                }
                return(false);

            case "checkcredits":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Input = Input.Replace("checkcredits", "");
                    Input = Input.Replace(" ", "");

                    uint ID = CharacterResolverCache.GetUidFromName(actor.Name);
                    actor.Whisper(checkcredits(Input), ID, false);

                    return(true);
                }
                return(false);

            case "block_coco":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Ha bloqueado el coco.", 3, ChatType.Say), 0, false);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Coco On.", 3, ChatType.Say), 0, false);
                    block_coco = true;

                    return(true);
                }
                return(false);



            case "unblock_coco":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": ha desbloqueado el coco.", 3, ChatType.Say), 0, false);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Coco Off.", 3, ChatType.Say), 0, false);
                    block_coco = false;

                    return(true);
                }
                return(false);



            case "ban":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 && actor.Name != "DaLoe" || referenceObject.Staff == 6)
                {
                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();
                    string            Input2      = Input;
                    string            reason2     = Input2.Substring(Input2.IndexOf(',') + 1);
                    Input = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     UserID   = CharacterResolverCache.GetUidFromName(username);
                    Moderation.ModerationBanManager.BanHammer(mySqlClient, UserID, reason2, actor.Name);
                    string ban = string.Format("{0}: Banned: {1}, For: {2}", actor.Name, username, reason2);

                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(username);

                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        Session Session_ID  = SessionManager.GetSessionByCharacterId(ID);
                        uint    session_id2 = Session_ID.CharacterInfo.SessionId;
                        SessionManager.StopSession(session_id2);
                    }

                    else
                    {
                    }

                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);

            case "unban":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 && actor.Name != "DaLoe" && actor.Name != "Fran" || referenceObject.Staff == 6)
                {
                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();
                    Input = Input.Replace("unban", "");
                    Input = Input.Replace(" ", "");

                    uint ID = CharacterResolverCache.GetUidFromName(Input);



                    Moderation.ModerationBanManager.Unban(mySqlClient, ID);

                    string unban = string.Format("{0}: Unbanned User {1}", actor.Name, Input);

                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, unban, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);

            case "ipban":
                if (referenceObject.Staff == 2 && actor.Name != "DaLoE" && actor.Name != "Fran" || referenceObject.Staff == 6)
                {
                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();
                    string            Input2      = Input;
                    string            reason2     = Input2.Substring(Input2.IndexOf(',') + 1);
                    Input = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     UserID   = CharacterResolverCache.GetUidFromName(username);

                    Sessions.Session session_0;
                    session_0 = SessionManager.GetSessionByCharacterId(UserID);
                    string str = session_0.RemoteAddress.ToString();

                    Moderation.ModerationBanManager.BanHammer3(mySqlClient, UserID, reason2, actor.Name, str);
                    string ban = string.Format("{0}: IP Banned: {1}, For: {2}", actor.Name, username, reason2);

                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(username);

                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        Session Session_ID  = SessionManager.GetSessionByCharacterId(ID);
                        uint    session_id2 = Session_ID.CharacterInfo.SessionId;
                        SessionManager.StopSession(session_id2);
                    }

                    else
                    {
                    }

                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);

            case "alert":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false);
                    return(true);
                }
                return(false);

            case "la":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    if (actor.Name == "Brandon" || actor.Name == "Mike")
                    {
                        foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                        {
                            Input = Input.Replace("la", "");
                            string send = string.Format("{0} - From Burbian Creator {1}", Input, actor.Name);
                            pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2));
                        }
                    }


                    else if (actor.Name == "Kyle")
                    {
                        foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                        {
                            Input = Input.Replace("la", "");
                            string send = string.Format("{0} - From Burbian Main Programmer {1}", Input, actor.Name);
                            pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2));
                        }
                    }

                    else if (referenceObject.Staff == 1)
                    {
                        foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                        {
                            Input = Input.Replace("la", "");
                            string send = string.Format("{0} - From Burbian Moderator {1}", Input, actor.Name);
                            pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2));
                        }
                    }


                    else if (referenceObject.Staff == 2 && actor.Name != "Brandon" && actor.Name != "Mike")
                    {
                        foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                        {
                            Input = Input.Replace("la", "");
                            string send = string.Format("{0} - From Burbian Administrator {1}", Input, actor.Name);
                            pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2));
                        }
                    }


                    else if (referenceObject.Staff == 6 && actor.Name != "Kyle")
                    {
                        foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                        {
                            Input = Input.Replace("la", "");
                            string send = string.Format("{0} - From Burbian Programmer {1}", Input, actor.Name);
                            pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2));
                        }
                    }

                    else
                    {
                        foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                        {
                            Input = Input.Replace("la", "");
                            string send = string.Format("{0} - From Burbian Moderator {1}", Input, actor.Name);
                            pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2));
                        }
                    }

                    return(true);
                }
                return(false);

            case "effect":
                if (referenceObject.Vip == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Input = Input.Replace("effect", "");
                    Input = Input.Replace(" ", "");

                    switch (int.Parse(Input))
                    {
                    case 1:
                        actor.ApplyEffect(1, true);
                        actor.UpdateNeeded = true;
                        break;

                    case 2:
                        actor.ApplyEffect(2, true);
                        actor.UpdateNeeded = true;
                        break;

                    case 3:
                        actor.ApplyEffect(3, true);
                        actor.UpdateNeeded = true;
                        break;

                    case 4:
                        actor.ApplyEffect(4, true);
                        actor.UpdateNeeded = true;
                        break;
                    }



                    return(true);
                }
                return(false);


            case "give":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Session session_0;



                    string userthatadded = actor.Name;


                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();

                    int credits = 0;

                    string Input2  = Input;
                    string reason2 = Input2.Substring(Input2.IndexOf(',') + 1);
                    credits = int.Parse(reason2);
                    Input   = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     ID       = CharacterResolverCache.GetUidFromName(username);

                    session_0 = SessionManager.GetSessionByCharacterId(ID);

                    //givecredits2(mySqlClient, credits, username);
                    referenceObject.UpdateGoldCreditsBalance(mySqlClient, +credits);
                    session_0.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(credits)), false);     //Punch cost 200
                    string str = string.Format("{0}: Gave {1}, {2} Credits!", userthatadded, username, credits);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);

            case "share":
                if (referenceObject.Staff == 0 || referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 3 || referenceObject.Staff == 4 || referenceObject.Staff == 5 || referenceObject.Staff == 6)
                {
                    string            BeforeComma = string.Empty;
                    string            AfterComma  = string.Empty;
                    SqlDatabaseClient client      = SqlDatabaseManager.GetClient();
                    Session           session_0;
                    Session           session_1;

                    Input = Input.Replace("share", "");
                    Input = Input.Replace(" ", "");

                    BeforeComma = Input.Remove(Input.LastIndexOf(','));
                    AfterComma  = Input.Substring(Input.IndexOf(',') + 1);

                    string username          = BeforeComma.Replace(" ", "");
                    string amountofcredits_0 = AfterComma.Replace(" ", "");
                    int    amount            = int.Parse(amountofcredits_0);


                    uint actorID  = CharacterResolverCache.GetUidFromName(actor.Name);
                    uint actorID2 = CharacterResolverCache.GetUidFromName(username);

                    session_0 = SessionManager.GetSessionByCharacterId(actorID);
                    session_1 = SessionManager.GetSessionByCharacterId(actorID2);

                    SpaceInstance instanceBySpaceId2 = SpaceManager.GetInstanceBySpaceId(session_1.CurrentSpaceId);
                    SpaceActor    actor2             = (instanceBySpaceId2 == null) ? null : instanceBySpaceId2.GetActorByReferenceId(session_1.CharacterId, SpaceActorType.UserCharacter);
                    CharacterInfo referenceObject2   = (CharacterInfo)actor2.ReferenceObject;



                    if (enoughcredits(session_0, amount))
                    {
                        referenceObject.UpdateGoldCreditsBalance(client, -amount);
                        session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(amount)), false);

                        referenceObject2.UpdateGoldCreditsBalance(client, +amount);
                        session_1.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(amount)), false);

                        string str = string.Format("{0}: Shared {1} Credits To {2}!", actor.Name, amount, username);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);
                    }

                    else
                    {
                        string str = string.Format("Could not send {0} the credits, did you have enough?", username);
                        actor.Whisper(str, actorID, false);
                    }



                    return(true);
                }
                return(false);


            case "take":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Session session_0;
                    Session session_1;


                    uint actoeid = CharacterResolverCache.GetUidFromName(actor.Name);


                    string userthatadded = actor.Name;


                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();

                    int credits = 0;

                    string Input2  = Input;
                    string reason2 = Input2.Substring(Input2.IndexOf(',') + 1);
                    credits = int.Parse(reason2);
                    Input   = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     ID       = CharacterResolverCache.GetUidFromName(username);

                    session_0 = SessionManager.GetSessionByCharacterId(ID);

                    //givecredits2(mySqlClient, credits, username);
                    session_1 = SessionManager.GetSessionByCharacterId(ID);
                    int gold      = session_1.CharacterInfo.GoldCoins;
                    int minusgold = gold - credits;

                    if (minusgold < 0)
                    {
                        actor.Whisper("Error, the amount you tried to give was below 0", actoeid, false);
                    }

                    else
                    {
                        referenceObject.UpdateGoldCreditsBalance(mySqlClient, -credits);
                        session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(credits)), false);
                        string str = string.Format("{0}: Took Away {1} Credits From {2}!", userthatadded, credits, username);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);
                    }

                    return(true);
                }
                return(false);



            case "kick":
                if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Session session_0;

                    Input = Input.Replace("kick", "");
                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(Input);
                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        session_0 = SessionManager.GetSessionByCharacterId(ID);
                        SpaceManager.RemoveUserFromSpace(session_0);
                        string str = string.Format("{0}: Has Kicked {1} From Island.", actor.Name, Input);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);
                    }

                    else
                    {
                    }

                    //SpaceManager.GetInstanceBySpaceId

                    //SpaceUserRemovedComposer.BroadcastCompose(



                    return(true);
                }
                return(false);

            case "kickoffline":
                if (referenceObject.Staff == 2 || referenceObject.Staff == 6)
                {
                    Session session_0;

                    Input = Input.Replace("kickoffline", "");
                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(Input);
                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        session_0 = SessionManager.GetSessionByCharacterId(ID);
                        uint session_id2 = session_0.CharacterInfo.SessionId;
                        SessionManager.StopSession(session_id2);
                        string str = string.Format("{0}: Has kicked {1} Offline!", actor.Name, Input);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);
                    }

                    else
                    {
                    }

                    //SpaceManager.GetInstanceBySpaceId

                    //SpaceUserRemovedComposer.BroadcastCompose(



                    return(true);
                }
                return(false);

            case "mod":
                if (actor.Name == "Kyle" || actor.Name == "Brandon" || actor.Name == "Mike")
                {
                    Session session_0;

                    SqlDatabaseClient client;
                    client = SqlDatabaseManager.GetClient();
                    Input  = Input.Replace("mod", "");
                    Input  = Input.Replace(" ", "");
                    string Input2 = Input;

                    string level = Input2.Substring(Input2.IndexOf(",") + 1);
                    uint   mod   = Convert.ToUInt32(level);

                    if (Input.Contains(","))
                    {
                        Input = Input.Substring(0, Input.LastIndexOf(","));
                    }
                    givemod(client, Input, mod);
                    string str = string.Format("{0}: Gave {1} Level {2} Mod Ability.", actor.Name, Input, mod);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);

                    uint ID = CharacterResolverCache.GetUidFromName(Input);
                    session_0 = SessionManager.GetSessionByCharacterId(ID);
                    uint session_id2 = session_0.CharacterInfo.SessionId;
                    SessionManager.StopSession(session_id2);



                    return(true);
                }
                return(false);

            case "getmod":
                if (actor.Name == "Kyle" || actor.Name == "Brandon" || actor.Name == "Mike")
                {
                    SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient();
                    Input = Input.Replace("getmod", "");
                    Input = Input.Replace(" ", "");

                    uint ID2 = CharacterResolverCache.GetUidFromName(actor.Name);
                    uint ID  = CharacterResolverCache.GetUidFromName(Input);

                    Session session_1;

                    session_1 = SessionManager.GetSessionByCharacterId(ID);
                    uint modlevel = session_1.CharacterInfo.Staff;

                    string str = string.Format("User {0} is mod level {1}", Input, modlevel);
                    actor.Whisper(str, ID2, false);

                    SessionManager.StopSession(session_1.AbsoluteSpaceId);


                    return(true);
                }
                return(false);
            }


            return(false);
        }
Ejemplo n.º 7
0
        public static bool HandleCommand(Session Session, string Input)
        {
            Input = Input.Substring(1, Input.Length - 1);
            string[]      input             = Input.Split(new char[] { ' ' });
            SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId);
            SpaceActor    actor             = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter);
            CharacterInfo referenceObject   = (CharacterInfo)actor.ReferenceObject;



            switch (input[0])
            {
            case "position":
            {
                Session.SendData(SpaceChatComposer.Compose(0, string.Concat(new object[] { "Tu posici\x00f3n actual es - X: ", actor.Position.Int32_0, ", Y: ", actor.Position.Int32_1, ", Z: ", actor.Position.Int32_2 }), 3, ChatType.Say), false);
                return(true);
            }

            case "block":
                if (referenceObject.Staff != 0)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha bloqueado el punch.", 3, ChatType.Say), 0, false);
                    block = true;
                    return(true);
                }
                return(false);

            case "unblock":
                if (referenceObject.Staff != 0)
                {
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha desbloqueado el punch.", 3, ChatType.Say), 0, false);
                    block = false;
                    return(true);
                }
                return(false);

            case "ban":
                if (referenceObject.Staff == 2)
                {
                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();
                    string            Input2      = Input;
                    string            reason2     = Input2.Substring(Input2.IndexOf(',') + 1);
                    Input = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     UserID   = CharacterResolverCache.GetUidFromName(username);
                    Moderation.ModerationBanManager.BanHammer(mySqlClient, UserID, reason2, actor.Name);
                    string ban = string.Format("{0} ha baneado a {1} por {2}", actor.Name, username, reason2);

                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(username);

                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        Session Session_ID  = SessionManager.GetSessionByCharacterId(ID);
                        uint    session_id2 = Session_ID.CharacterInfo.SessionId;
                        SessionManager.StopSession(session_id2);
                    }

                    else
                    {
                    }

                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);

            case "alert":
                if (referenceObject.Staff != 0)
                {
                    string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false);
                    return(true);
                }
                return(false);

            case "la":
                if (referenceObject.Staff != 0)
                {
                    foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions)
                    {
                        pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, Input.Replace("la", ""), 2));
                    }
                    return(true);
                }
                return(false);


            case "give":
                if (referenceObject.Staff == 2)
                {
                    Session session_0;
                    string  userthatadded = actor.Name;


                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();

                    int credits = 0;

                    string Input2  = Input;
                    string reason2 = Input2.Substring(Input2.IndexOf(',') + 1);
                    credits = int.Parse(reason2);
                    Input   = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     ID       = CharacterResolverCache.GetUidFromName(username);

                    session_0 = SessionManager.GetSessionByCharacterId(ID);

                    //givecredits2(mySqlClient, credits, username);
                    referenceObject.UpdateGoldCreditsBalance(mySqlClient, +credits);
                    session_0.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(credits)), false);     //Punch cost 200
                    string str = string.Format("{0} le ha dado a {1} {2} Creditos!", userthatadded, username, credits);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);


            case "take":
                if (referenceObject.Staff == 2)
                {
                    Session session_0;
                    string  userthatadded = actor.Name;

                    SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient();

                    int credits = 0;

                    string Input2  = Input;
                    string reason2 = Input2.Substring(Input2.IndexOf(',') + 1);
                    credits = int.Parse(reason2);
                    Input   = Input.Replace(",", "");
                    string[] split    = Input.Split(' ');
                    string   username = (split[1]);
                    string   reason   = string.Join(" ", Input, 2, Input.Length - 2);
                    uint     ID       = CharacterResolverCache.GetUidFromName(username);

                    session_0 = SessionManager.GetSessionByCharacterId(ID);

                    referenceObject.UpdateGoldCreditsBalance(mySqlClient, -credits);
                    session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(credits)), false);     //Punch cost 200
                    string str = string.Format("{0} le ha quitado {1} Creditos a {2}!", userthatadded, credits, username);
                    instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);


                    return(true);
                }
                return(false);


            case "kick":
                if (referenceObject.Staff != 0)
                {
                    Session session_0;

                    Input = Input.Replace("kick", "");
                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(Input);
                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        session_0 = SessionManager.GetSessionByCharacterId(ID);
                        SpaceManager.RemoveUserFromSpace(session_0);
                        string str = string.Format("{0} echa a {1} de la isla", actor.Name, Input);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);
                    }
                    return(true);
                }
                return(false);

            case "kickoffline":
                if (referenceObject.Staff == 2)
                {
                    Session session_0;

                    Input = Input.Replace("kickoffline", "");
                    Input = Input.Replace(" ", "");
                    uint ID = CharacterResolverCache.GetUidFromName(Input);
                    if (SessionManager.ContainsCharacterId(ID))
                    {
                        session_0 = SessionManager.GetSessionByCharacterId(ID);
                        uint session_id2 = session_0.CharacterInfo.SessionId;
                        SessionManager.StopSession(session_id2);
                        string str = string.Format("{0} desconectó a {1}", actor.Name, Input);
                        instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false);
                    }

                    //SpaceManager.GetInstanceBySpaceId

                    //SpaceUserRemovedComposer.BroadcastCompose(



                    return(true);
                }
                return(false);

            case "chest1":
                if (referenceObject.Staff == 2)
                {
                    return(true);
                }
                return(false);
            }


            return(false);
        }