コード例 #1
0
ファイル: AssessThreat.cs プロジェクト: waebbl/CS-ELBot
        private void OnAddNewActor(object sender, ActorHandler.AddNewActorEventArgs e)
        {
            if (MainClass.botType != 3)
            {
                //shouldn't be here anyways, since we're not creating this object if it's not a guard bot, but just in case, lol
                return;
            }
            if (e.NewActor.id == TheActorHandler.MyActorID)
            {
                return;
            }
            userRank = TheMySqlManager.GetUserRank(e.NewActor.name, Settings.botid);
            string tempText = "";

            if (userRank < -2)
            {
                userRank = -2;
            }
            switch (userRank)
            {
            case -2:
                //send out a message that will be picked up by the guardbot handler
                //send message to guild/owners if specified.... (have to think this out...)
                //kill on sight
                tempText = e.NewActor.name + ", you are kill on sight and must be terminated!";
                break;

            case -1:
                //check the timer to see if they should be killed, if so, change rank to -2
                //send messages...
                tempText = e.NewActor.name + ", you are a threat and will be terminated if you continue to tresspass!";
                break;

            case 0:
                //give a warning and set the timer, change rank to -1
                tempText = e.NewActor.name + ", you are tresspassing, if you continue to do so you will be designated for termination!";
                break;

            default:
                //check the timer, if it's expired, switch to rank 0
                //otherwise don't do a thing...
                tempText = e.NewActor.name + ", you are not a threat.  You may pass.";
                break;
            }
            if (tempText != "")
            {
                TheTCPWrapper.Send(CommandCreator.RAW_TEXT(tempText));
                System.Threading.Thread.Sleep(20);
            }
            string guild = TheMySqlManager.PlayerGuild(Settings.Loginname);

            tempText = "#gm " + e.NewActor.name + " has entered the field of play(rank: " + userRank + ")";
            if (guild == "0")
            {
                tempText = "FAKE " + tempText;
            }
            TheTCPWrapper.Send(CommandCreator.RAW_TEXT(tempText));
            TheActorHandler.setActorThreatLevel(e.NewActor, userRank);
        }
コード例 #2
0
		private void OnAddNewActor(object sender, ActorHandler.AddNewActorEventArgs e)
		{
			string greeting = TheMySqlManager.Getgreeting(e.NewActor.name,Settings.botid);
			
			if (greeting!="")
			{
                //don't greet invisible players
                if (e.NewActor.buffs != 0)
                    return;
				TheTCPWrapper.Send(CommandCreator.RAW_TEXT(greeting));
                TheMySqlManager.updateGreeting(e.NewActor.name, Settings.botid);
			}
		}