⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atcomand.c

📁 CS反恐精英1.6的部分C源代码。
💻 C
📖 第 1 页 / 共 2 页
字号:
				WFIFOW(fd,2) = 5;
				WFIFOW(fd,4) = p->max_hp - p->hp;
				WFIFOSET(fd,6);

				WFIFOW(fd,0) = 0x13d;
				WFIFOW(fd,2) = 7;
				WFIFOW(fd,4) = p->max_sp - p->sp;
				WFIFOSET(fd,6);
				p->hp = p->max_hp+1;
				p->sp = p->max_sp+1;

			}else if(x >= -10000 && x <= 10000 && y>= -10000 && y <= 10000){
				p->hp += x;
				p->sp += y;
				WFIFOW(fd,0) = 0x13d;
				WFIFOW(fd,2) = 5;
				WFIFOW(fd,4) = x;
				WFIFOSET(fd,6);

				WFIFOW(fd,0) = 0x13d;
				WFIFOW(fd,2) = 7;
				WFIFOW(fd,4) = y;
				WFIFOSET(fd,6);
			}
			//Once HP/SP reach their maximum values stop healing.
					if(p->hp > p->max_hp || p->hp < 0){
					p->hp = p->max_hp;
					WFIFOW(fd,0) = 0xb0;
					WFIFOW(fd,2) = 0005;
					WFIFOL(fd,4) = p->hp;
					WFIFOSET(fd,8);
					}

					if(p->sp > p->max_sp || p->sp < 0){
					p->sp = p->max_sp;
					WFIFOW(fd,0) = 0xb0;
					WFIFOW(fd,2) = 0007;
					WFIFOL(fd,4) = p->sp;
					WFIFOSET(fd,8);
					}

					strcpy(moji,"HP and SP recovered.");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
					goto idou;//hide the !command text from other users
      }


//item spawn
//!item <itemID quantity>
			x=501;y=1;
      		sscanf(message,"%s%d%d",comand,&x,&y);
			if(strncmp(comand,"!item",5)==0){
				struct item tmp_item;

				if(is_item(x)==1){
					char moji[200];
      			memset(&tmp_item,0,sizeof(tmp_item));
      			tmp_item.nameid=x;
      			tmp_item.amount=y;
      			tmp_item.identify=1;
      			len=mmo_map_item_get(fd,WFIFOP(fd,0),&tmp_item);
      			if(len>0) WFIFOSET(fd,len);

					strcpy(moji,"Got item!");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
			      goto idou;//hide the !command text from other users
			    }else{
					char moji[200];
					strcpy(moji,"No item with that ID exists!");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
			    	goto idou;
			    }
      }

//彑庤偵幚憰!popee (used to be !popee?)
//Level Up! command (base)
//!Lvup <no input>
			sscanf(message,"%s%d",comand,&x);
			if(strncmp(comand,"!base_up",8)==0){
				if(p->base_level + x <= 99){
					char moji[200];
					mmo_map_level_up(fd,x);
					strcpy(moji,"Level UP!");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
				goto idou;//hide the !command text from other users
				}
				else
				{
					strcpy(moji,"Max Baseup is level 99 or base_up 98 assuming level 1");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
					goto idou;//hide the !command text from other users
				}
			}

//monster spawn
//!spawn <monster ID>
sscanf(message,"%s%d",comand,&x);
			if(strncmp(comand,"!spawn",6)==0){

			if( (44 < x) && (x < 140) )  {spawn_monster(x,sd->x,sd->y,sd->mapno,fd);}
			else if( (699 < x) && (x < 721) )  {spawn_monster(x,sd->x,sd->y,sd->mapno,fd);}
			else if( (1000 < x) && (x < 1253) )  {spawn_monster(x,sd->x,sd->y,sd->mapno,fd);}
			else {
					strcpy(moji,"Invalid monster ID!");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
			}
				goto idou;
}



//Level Up! command (job)
//!Lvup <no input>
			sscanf(message,"%s%d",comand,&x);
			if(strncmp(comand,"!job_up",7)==0){
				if(p->job_level + x <= 50){
					char moji[200];
					mmo_map_job_lv_up(fd,x);
					mmo_map_update_param(fd,SP_SKILLPOINT,x);
					strcpy(moji,"Your job level has been raised.");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
				goto idou;
				}
				else
				{
					strcpy(moji,"Job level 50 is the maximum.");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
					goto idou;
				}
			}



//!h help command explains !commands
//!h <no input>
			sscanf(message,"%s",comand);
			if(strncmp(comand,"!h",2)==0 || strncmp(comand,"!help",5)==0 ){
					char moji[400];
					FILE *file;
					file = fopen("config/help.txt","r");

					sprintf(moji,"Help Commands");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
					while(fgets(moji,380,file)!=NULL){
						strcat(moji," \n");
						WFIFOW(fd,0) = 0x8e;
						WFIFOW(fd,2) = 4+strlen(moji);
						memcpy(WFIFOP(fd,4),moji,strlen(moji));
						WFIFOSET(fd,4 + strlen(moji));
					}
					fclose(file);
				goto idou;//hide the !command text from other users
			}

//!GM enables GM sprite.丂Still doesn乫t work correctly. Requires relogin.
//!GM <no input>
/*
	R 006b <len>.w <character select data>.106B*
	Character select connection success & character data
	<character select data> = <character ID>.l <base exp>.l <zeny>.l <job exp>.l <job level>.l ?.8B <option>.l <karma>.l <manner>.l ?.2B <HP>.w <MaxHP>.w <SP>.w <MaxSP>.w <speed>.w <class>.w <hair>.w ?.2w <base level>.w <skill point>.w ?.w <sheild>.w <head option top>.w <head option mid>.w <hair color>.w ?.w <name>.24B <STR>.B <AGI>.B <VIT>.B <INT>.B <DEX>.B <LUK>.B <character number>.B ?.B
*/
			sscanf(message,"%s",comand);
			if(strncmp(comand,"!GM",3)==0){
					char moji[200];
				int next_id;
				next_id = mmo_char_GM(sd);
				WFIFOW(char_fd,0)=0x3001;
				WFIFOL(char_fd,2)=fd;
				WFIFOSET(char_fd,6);
				sd->account_id=next_id;
				sd->status.account_id=next_id;
					strcpy(moji,"Want to be a game master?");
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					memcpy(WFIFOP(fd,4),moji,strlen(moji));
					WFIFOSET(fd,4 + strlen(moji));
				goto idou;//hide the !command text from other users
			}
//PVP cancellation (PVP must be disabled on every map it was enabled)
//!pvpoff <no input>
          		sscanf(message,"%s",comand);
	         	if(strncmp(comand,"!pvpoff",7) == 0){
               		  char moji[200];
				WFIFOW(fd,0)=0x199;
				WFIFOW(fd,2)=1;
				WFIFOSET(fd,4);
					strcpy(moji,"Player Versus Player : DISABLED");
                 	  WFIFOW(fd,0) = 0x8e;
                    	  WFIFOW(fd,2) = 4 + strlen(moji);
                   	  memcpy(WFIFOP(fd,4),moji,strlen(moji));
               	          WFIFOSET(fd,4 + strlen(moji));
                          PVP_flag=0;
            		  goto idou;
	                }
//PVP enable
//!pvp <no input>
	               sscanf(message,"%s",comand);
       		       if(strncmp(comand,"!pvpon",6)==0){
              		 char moji[200];
				WFIFOW(fd,0)=0x199;
				WFIFOW(fd,2)=1;
				WFIFOSET(fd,4);
			//	mmo_map_sendarea( fd, WFIFOP(fd,0), packet_len_table[0x199], 0 );
				WFIFOW(fd,0) = 0x19a;
				WFIFOL(fd,2) = sd->account_id;
				WFIFOL(fd,6) = rank;
				WFIFOL(fd,10) = users_global;
				mmo_map_sendarea( fd, WFIFOP(fd,0), packet_len_table[0x19a], 0 );
					strcpy(moji,"Player Versus Player : ENABLED");
                  	 WFIFOW(fd,0) = 0x8e;
                	 WFIFOW(fd,2) = 4 + strlen(moji);
             	         memcpy(WFIFOP(fd,4),moji,strlen(moji));
                    	 WFIFOSET(fd,4 + strlen(moji));
                    	 PVP_flag=1;
                	 goto idou;
			}


//!model modifies hair type, hair color, and clothing color
//!model <x y z> (when 2hq is used, it causes an error...(丩凞丮))
/*	Example丗!model 15 4 0

x [0乣17]Hair type
y [0乣8]Hair color
z [0乣4]Clothing color

*/
			sscanf(message,"%s%d%d%d",comand,&x,&y,&z);
			if(strncmp(comand,"!model",6)==0){
			char moji[200];
				if(x >= 0 && x < 18 && y >=0 && y < 9 && z >= 0 && z <= 4){
	            //暈偺怓曄峏
	            if (sd->status.class == 12){
	                //傾僒僔儞偼暈偺怓枹幚憰
	                	strcpy(moji,"Assassin isn't working yet...");
						WFIFOW(fd,0) = 0x8e;
						WFIFOW(fd,2) = 4 + strlen(moji);
						memcpy(WFIFOP(fd,4),moji,strlen(moji));
						WFIFOSET(fd,4 + strlen(moji));
	              	}else{
	            	sd->status.hair = x;
	            	sd->status.hair_color = y;
	            	sd->status.clothes_color = z;

	            	WFIFOW(fd,0) = 0xc3;
	            	WFIFOL(fd,2) = sd->account_id;
	            	WFIFOB(fd,6) = 1;
	            	WFIFOB(fd,7) = x;
	            	WFIFOSET(fd,8);

	            	WFIFOW(fd,0) = 0xc3;
	            	WFIFOL(fd,2) = sd->account_id;
	            	WFIFOB(fd,6) = 6;
	            	WFIFOB(fd,7) = y;
	            	WFIFOSET(fd,8);

	            	WFIFOW(fd,0) = 0xc3;
	            	WFIFOL(fd,2) = sd->account_id;
	            	WFIFOB(fd,6) = 7;
	            	WFIFOB(fd,7) = z;
	            	WFIFOSET(fd,8);
	            }
						strcpy(moji,"Amazing!");
						WFIFOW(fd,0) = 0x8e;
						WFIFOW(fd,2) = 4 + strlen(moji);
						memcpy(WFIFOP(fd,4),moji,strlen(moji));
						WFIFOSET(fd,4 + strlen(moji));
					goto idou;
				}else{
						strcpy(moji,"Invalid values. Cancelled!");
						WFIFOW(fd,0) = 0x8e;
						WFIFOW(fd,2) = 4 + strlen(moji);
						memcpy(WFIFOP(fd,4),moji,strlen(moji));
						WFIFOSET(fd,4 + strlen(moji));
				}
			}










//!test command for debugging. (please do not make changes)
//!test <no input>
//			R 00fb <len>.w <party name>.24B {<ID>.l <nick>.24B <map name>.16B <leader>.B <offline>.B}.46B*
			sscanf(message,"%s",comand);
			if(strncmp(comand,"!test",5)==0){
				WFIFOW(fd,0) = 0xfb;
				WFIFOW(fd,2) = 74;
				strcpy(WFIFOP(fd,4),"Horseman group");
				WFIFOL(fd,28) = 100006;
				strcpy(WFIFOP(fd,32),"Applying~");
				strcpy(WFIFOP(fd,56),"Where?");
				WFIFOB(fd,72)=1;
				WFIFOB(fd,73)=1;
				WFIFOSET(fd,74);
				goto idou;
			}


		sscanf(message,"%s",comand);
		if(strncmp(comand,"!reload_config",5)==0){
			reload_config();
			goto idou;
		}




//!test command for debugging. (please do not make changes)
//!test <no input>
/*
R 0196 <type>.w <ID>.l
	(庡偵?)僾儕娭學偺憹嫮傕偺怓乆丅ID偼target偲巚傢傟傞偑帺暘憡庤偺傒偟偐棃側偄?
	Mainly a reinforcement pre-relationship. (???)
	ID might be the target, but it only works on other players? (???)
	type=02 IMPOSITIO grant
	type=03 IMPOSITIO cancel
	type=07 ASPERSIO grant
	type=08 ASPERSIO cancel
	type=0b KYRIE grant
	type=0c KYRIE cancel
*/
			sscanf(message,"%s%d",comand,&x);
			if(strncmp(comand,"!debug",6)==0){
				WFIFOW(fd,0) = 0x196;
				WFIFOW(fd,2) = x;
				WFIFOL(fd,4) = sd->account_id;
				WFIFOSET(fd,8);
				goto idou;
			}


//ADDED
//!rura revised
//!go <value[1-7]>
/*
	0=Prontera
	1=Morroc
	2=Geffen
	3=Payon
	4=Alberta
	5=Izlude
	6=Al de Baron
	7=Lutie
*/
			sscanf(message,"%s%d",comand,&x);
			if(strncmp(comand,"!go",3)==0)
			{
      			if(x==0)
      			{
             		mmo_map_changemap(fd,sd,"prontera.gat",156,191,2);
          			goto idou;
				}
				else if(x==1)
				{
             		mmo_map_changemap(fd,sd,"morocc.gat",156,96,2);
          			goto idou;
				}
				else if(x==2)
				{
             		mmo_map_changemap(fd,sd,"geffen.gat",119,60,2);
          			goto idou;
				}
				else if(x==3)
				{
             		mmo_map_changemap(fd,sd,"payon.gat",89,122,2);
          			goto idou;
				}
				else if(x==4)
				{
             		mmo_map_changemap(fd,sd,"alberta.gat",192,147,2);
          			goto idou;
				}
				else if(x==5)
				{
             		mmo_map_changemap(fd,sd,"izlude.gat",128,114,2);
          			goto idou;
				}
				else if(x==6)
				{
             		mmo_map_changemap(fd,sd,"aldebaran.gat",140,131,2);
          			goto idou;
				}
				else if(x==7)
				{
             		mmo_map_changemap(fd,sd,"xmas.gat",147,134,2);
          			goto idou;
				}
				else
				{
					char *moji;
					moji="Error in map destination...";
					WFIFOW(fd,0) = 0x8e;
					WFIFOW(fd,2) = 4 + strlen(moji);
					strcpy(WFIFOP(fd,4),moji);
					WFIFOSET(fd,4 + strlen(moji));
          			goto idou;//hide the !command text from other users
				}
			}



	}
}



/************************************************************************************/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -