Beispiel #1
0
        public static void SetGmLevel(Character character, Match match)
        {
            Character ncharacter;

            if (Tasks.LifeCycle.TryGetByName(match.Groups[1].Value, out ncharacter))
            {
                int gmlevel = int.Parse(match.Groups[1].Value);
                Common.Actions.SetGmLevel(gmlevel, character, ncharacter);
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "Character with that name is not online");
            }
        }
Beispiel #2
0
        public static void Unspawn(Character character, Match match)
        {
            uint model = uint.Parse(match.Groups[2].Value);
            byte b     = byte.Parse(match.Groups[1].Value);

            if (character.Target != null && !(character.Target is Character))
            {
                Singleton.Templates.UnspawnInstance(character.Target);
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "No actor selected or actor is a player");
            }
        }
Beispiel #3
0
        public static void MoveMap(Character character, Match match)
        {
            Point coord;

            switch (Convert.ToInt16(match.Groups[1].Value))
            {
            case 1:                     //Hodemimes:1
                coord.x = 3241f;
                coord.y = -13725;
                coord.z = -6415;
                byte map1 = Convert.ToByte(1);
                CommonFunctions.Warp(character, map1, coord);
                break;

            case 2:                     //Prontera:5
                coord.x = 11643f;
                coord.y = 77005;
                coord.z = 5094;
                byte map2 = Convert.ToByte(5);
                CommonFunctions.Warp(character, map2, coord);
                break;

            case 3:                     //Cognito:12
                coord.x = -8423f;
                coord.y = -20354;
                coord.z = 6173;
                byte map3 = Convert.ToByte(12);
                CommonFunctions.Warp(character, map3, coord);
                break;

            case 4:                     //Alfheim:20
                coord.x = -24258f;
                coord.y = -23086;
                coord.z = 11107;
                byte map4 = Convert.ToByte(20);
                CommonFunctions.Warp(character, map4, coord);
                break;

            default:
                CommonFunctions.Broadcast(character, character, "List of Maps:");
                CommonFunctions.Broadcast(character, character, "/move 1 - Hodemimes");
                CommonFunctions.Broadcast(character, character, "/move 2 - Prontera");
                CommonFunctions.Broadcast(character, character, "/move 3 - Cognito Town");
                CommonFunctions.Broadcast(character, character, "/move 4 - Alfheim");
                break;
            }
        }
Beispiel #4
0
        public static void Kick(Character character, Match match)
        {
            Character ncharacter;

            if (Tasks.LifeCycle.TryGetByName(match.Groups[1].Value, out ncharacter))
            {
                Common.Actions.Kick(ncharacter);
                if (ncharacter.id != character.id)
                {
                    CommonFunctions.Broadcast(character, character, "Character is kicked");
                }
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "Character with that name is not online");
            }
        }
Beispiel #5
0
        public static void PlayerJump(Character character, Match match)
        {
            Character characterTarget;

            if (Tasks.LifeCycle.TryGetByName(match.Groups[1].Value, out characterTarget))
            {
                CommonFunctions.Warp
                (
                    character,
                    characterTarget.Position,
                    characterTarget.currentzone
                );
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "character was not found");
            }
        }
Beispiel #6
0
        public static void ScheduleMaintenance(Character character, Match match)
        {
            DateTime newdate = DateTime.ParseExact(match.Groups[0].Value, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture);

            if (newdate < DateTime.Now)
            {
                string message = "Maintaince is canceled";
                Tasks.Maintenance.IsScheduled             = false;
                Tasks.Maintenance.NextSceduledMaintenance = newdate;
                CommonFunctions.Broadcast(character, character, message);
            }
            else
            {
                string message = string.Format("Maintaince is scheduled on: {0}", newdate);
                Tasks.Maintenance.IsScheduled             = true;
                Tasks.Maintenance.NextSceduledMaintenance = newdate;
                CommonFunctions.SystemMessage(character, character, message);
            }
        }
Beispiel #7
0
        public static void Spawn(Character character, Match match)
        {
            uint model = uint.Parse(match.Groups[2].Value);
            byte b     = byte.Parse(match.Groups[1].Value);
            int  nb    = Convert.ToInt16(match.Groups[3].Value);

            if (b == 0)
            {
                MapObject instance = null;
                System.Threading.WaitCallback callback = delegate(object state)
                {
                    Singleton.Templates.UnspawnInstance(instance);
                };

                //if (Singleton.Templates.SpawnNpcInstance(model, character.Position, character.Yaw, character.currentzone, false, out instance))
                //{
                //QueedTask timer = new QueedTask(callback, instance, 300000);
                //}

                if (nb > 0)
                {
                    for (int i = 1; i <= nb; i++)
                    {
                        Singleton.Templates.SpawnNpcInstance(model, character.Position, character.Yaw, character.currentzone, false, out instance);
                    }
                }
            }
            else if (b == 1)
            {
                MapObject instance;
                Point     newPosition = character.Position;
                newPosition.x += (float)(200 * Math.Cos(character.Yaw.rotation * (Math.PI / 32768)));
                newPosition.y += (float)(200 * Math.Sin(character.Yaw.rotation * (Math.PI / 32768)));
                Singleton.Templates.SpawnItemInstance(model, newPosition, character.Yaw, character.currentzone, out instance);
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "Invalid argument");
            }
        }
Beispiel #8
0
        public static void ChatMute(Character character, Match match)
        {
            Character ncharacter;

            if (Tasks.LifeCycle.TryGetByName(match.Groups[1].Value, out ncharacter))
            {
                //Addition for chat mute
                if (character.GmLevel > ncharacter.GmLevel)
                {
                    Common.Skills.UpdateAddition(ncharacter, 1301, 3600000);
                    CommonFunctions.Broadcast(character, character, "Character is muted for one hour");
                }
                else
                {
                    CommonFunctions.Broadcast(character, character, "Cannot mute a supperior gm");
                }
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "Character with that name is not online");
            }
        }
Beispiel #9
0
        public static void GetZeny(Character character, Match match)
        {
            uint gzeny = uint.Parse(match.Groups[1].Value);

            if (gzeny < 1)
            {
                CommonFunctions.Broadcast(character, character, "command failed");
            }
            else
            {
                Character characterTarget;
                if (Tasks.LifeCycle.TryGetByName(match.Groups[2].Value, out characterTarget))
                {
                    characterTarget.ZENY += gzeny;
                    CommonFunctions.UpdateZeny(characterTarget);
                }
                else
                {
                    CommonFunctions.Broadcast(character, character, "character was not found");
                }
            }
        }
Beispiel #10
0
        public static void GetExp(Character character, Match match)
        {
            uint cexp = uint.Parse(match.Groups[1].Value);
            uint jexp = uint.Parse(match.Groups[2].Value);
            uint wexp = uint.Parse(match.Groups[3].Value);

            if (cexp < 0 || jexp < 0 || wexp < 0)
            {
                CommonFunctions.Broadcast(character, character, "command failed");
            }
            else
            {
                Character characterTarget;
                if (Tasks.LifeCycle.TryGetByName(match.Groups[4].Value, out characterTarget))
                {
                    Common.Experience.Add(characterTarget, cexp, jexp, wexp);
                }
                else
                {
                    CommonFunctions.Broadcast(character, character, "character was not found");
                }
            }
        }
Beispiel #11
0
 /// <summary>
 /// Confirms the current quests
 /// </summary>
 /// <remarks>
 /// Starts a new QuestBase, if the QuestBase isn't started before
 /// otherwise we'll just negiotate it.
 ///
 /// QuestBase_START from our lua file should be used for
 /// inventory checks if the QuestBase gives QuestBase items.
 /// So when the QuestBase fails to give the appropiate items
 /// it should have a fail mechanisme.
 /// </remarks>
 /// <param name="cpkt"></param>
 private void CM_QUESTCONFIRM(CMSG_QUESTCONFIRMED cpkt)
 {
     if (QuestBaseID == 0)
     {
         QuestBaseID = cpkt.QuestID;
         SMSG_QUESTCONFIRM spkt = new SMSG_QUESTCONFIRM();
         spkt.QuestID   = cpkt.QuestID;
         spkt.SessionId = this.character.id;
         this.Send((byte[])spkt);
     }
     else
     {
         try
         {
             QuestBase Quest;
             if (Singleton.Quests.TryFindQuests(cpkt.QuestID, out Quest) &&
                 Quest.OnStart(this.character.id) > -1)
             {
                 Quest.CheckQuest(this.character);
                 if (character._target != null)
                 {
                     Singleton.Quests.OpenQuest(character, character._target);
                 }
             }
             else
             {
                 QuestBase.InvalidateQuest(Quest, this.character);
                 //HAX: Add official quest failed error
                 CommonFunctions.Broadcast(this.character, this.character, "quest failed");
             }
         }
         finally
         {
             QuestBaseID = 0;
         }
     }
 }
        /// <summary>
        /// Occurs when a user speaks in general to the given channel
        /// </summary>
        /// <param name="cpkt"></param>
        private void CM_SENDCHAT(CMSG_SENDCHAT cpkt)
        {
            //Check if gm level is set prior to on checking if it's a gm command
            if (this.character.chatmute > 0)
            {
                CommonFunctions.Broadcast(this.character, this.character, "You've been muted");
            }
            else if (this.character.GmLevel >= 0 && ConsoleCommands.IsGMCommand(cpkt.Message))
            {
                ConsoleCommands.ParseGMCommand(cpkt.Message, this.character);
            }
            else
            {
                SMSG_SENDCHAT spkt = new SMSG_SENDCHAT();
                spkt.Message     = cpkt.Message;
                spkt.Name        = this.character.Name;
                spkt.MessageType = cpkt.MessageType;
                spkt.SessionId   = this.character.id;

                switch (spkt.MessageType)
                {
                case SMSG_SENDCHAT.MESSAGE_TYPE.CHANEL:
                    foreach (Character characterTarget in LifeCycle.Characters)
                    {
                        if (characterTarget.client.isloaded == false)
                        {
                            continue;
                        }
                        spkt.SessionId = characterTarget.id;
                        characterTarget.client.Send((byte[])spkt);
                    }
                    break;

                case SMSG_SENDCHAT.MESSAGE_TYPE.NORMAL:
                    foreach (MapObject myObject in this.character.currentzone.GetCharactersInSightRange(this.character))
                    {
                        Character characterTarget = (Character)myObject;
                        if (characterTarget.client.isloaded == false)
                        {
                            continue;
                        }
                        spkt.SessionId = characterTarget.id;
                        characterTarget.client.Send((byte[])spkt);
                    }
                    break;

                case SMSG_SENDCHAT.MESSAGE_TYPE.PARTY:
                    if (this.character.sessionParty != null)
                    {
                        foreach (Character myObject in this.character.sessionParty.GetCharacters())
                        {
                            spkt.SessionId = myObject.id;
                            myObject.client.Send((byte[])spkt);
                        }
                    }
                    else
                    {
                        spkt.MessageType2 = 0xFF;
                        spkt.SessionId    = this.character.id;
                        this.Send((byte[])spkt);
                    }
                    break;

                case SMSG_SENDCHAT.MESSAGE_TYPE.YELL:
                    foreach (MapObject myObject in this.character.currentzone.Regiontree.SearchActors(this.character, SearchFlags.Characters))
                    {
                        Character characterTarget = (Character)myObject;
                        if (characterTarget.client.isloaded == false)
                        {
                            continue;
                        }
                        spkt.SessionId = characterTarget.id;
                        characterTarget.client.Send((byte[])spkt);
                    }
                    break;

                default:
                    Trace.TraceError("Message type not found {0}", cpkt.MessageType);
                    spkt.MessageType2 = 0xFF;
                    spkt.SessionId    = this.character.id;
                    this.Send((byte[])spkt);
                    break;
                }
            }
        }
Beispiel #13
0
 public static void Position(Character character, Match match)
 {
     //Return the character's position
     CommonFunctions.Broadcast(character, character, string.Format("{0} on map {1}", character.Position, character.map));
 }
Beispiel #14
0
        public static void Kill(Character character, Match match)
        {
            Regiontree tree = character.currentzone.Regiontree;
            MapObject  regionObject;

            if (character.SelectedTarget > 0 && Regiontree.TryFind(character.SelectedTarget, character, out regionObject) && regionObject is Monster)
            {
                /*****
                *  //Make the Object die
                *****/
                Actor btarget = regionObject as Actor;
                btarget.Status.CurrentHp = 0;
                btarget.OnDie(character);
                character.OnEnemyDie(regionObject);
                btarget.stance          = 7;
                btarget.Status.Updates |= 1;

                /*****
                *  //Forcing updates to all surrounding objects (flusing)
                *****/
                Predicate <Character> SendToCharacter = delegate(Character forwardTarget)
                {
                    //Process some general updates
                    if (forwardTarget.SelectedTarget == regionObject.id)
                    {
                        Common.Actions.SelectActor(forwardTarget, regionObject as Actor);
                    }
                    Common.Actions.UpdateStance(forwardTarget, regionObject as Actor);
                    Common.Actions.UpdateIcon(forwardTarget, regionObject as BaseMob);
                    return(true);
                };

                /*****
                *  //Forcing updates to all surrounding objects (searching)
                *****/
                SendToCharacter(character);
                foreach (Character forwardTarget in tree.SearchActors(character, SearchFlags.Characters))
                {
                    if (forwardTarget.id == character.id)
                    {
                        continue;
                    }
                    SendToCharacter(forwardTarget);
                }

                /*****
                *  //Update lifecycle
                *****/
                LifeCycle.Update(character);
                if (MapObject.IsPlayer(regionObject))
                {
                    LifeCycle.Update(regionObject as Character);
                }

                /***
                 * Check Quest
                 ***/
                if (MapObject.IsNpc(btarget))
                {
                    Quests.QuestBase.UserEliminateTarget(btarget.ModelId, character);
                }
            }
            else
            {
                CommonFunctions.Broadcast(character, character, "No target selected or incorrect target");
            }
        }
Beispiel #15
0
        public static void ShowMaintenance(Character character, Match match)
        {
            string message = Tasks.Maintenance.IsScheduled ? string.Format("Maintaince is scheduled on: {0}", Tasks.Maintenance.NextSceduledMaintenance.ToShortTimeString()) : "Maintaince is not scheduled";

            CommonFunctions.Broadcast(character, message);
        }
Beispiel #16
0
 public static void GetPing(Character character, Match match)
 {
     using (Ping p = new Ping()) {
         CommonFunctions.Broadcast(character, character, p.Send("23.88.103.73").RoundtripTime.ToString() + "ms");
     }
 }