update
This commit is contained in:
		
							parent
							
								
									63b7d31a8a
								
							
						
					
					
						commit
						40df5ba19b
					
				
							
								
								
									
										31
									
								
								ttd.go
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								ttd.go
									
									
									
									
									
								
							| @ -234,7 +234,8 @@ func (s *ServerTTD) Poll(stop chan struct{}) { | ||||
| 			sp.Read(buffer[:p.PLength]) | ||||
| 			//logInfoDebug("Server.Poll() : AdminPacketServerClientInfo :\n-  ClientID: %d\n-  Address: %s\n-  Name: %s\n-  Lang: %d\n-  Date: %d\n-  CompanyID: %d", sp.ClientID, sp.Address, sp.Name, sp.Lang, sp.Date, sp.CompanyID) | ||||
| 			clt := &ClientTTD{ | ||||
| 				ClientID: sp.ClientID, | ||||
| 				ClientID:  sp.ClientID, | ||||
| 				CompanyID: 255, | ||||
| 			} | ||||
| 			if _, ok := s.Status.Clients[sp.ClientID]; ok { | ||||
| 				clt = s.Status.Clients[sp.ClientID] | ||||
| @ -275,7 +276,11 @@ func (s *ServerTTD) Poll(stop chan struct{}) { | ||||
| 					cc.Online = true | ||||
| 					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s playing.", cc.Username)) | ||||
| 				} else { | ||||
| 					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("%s unclaimed. Please /register to claim the company", s.Status.Companies[sp.CompanyID].Name)) | ||||
| 					if co, ok := s.Status.Companies[sp.CompanyID]; ok { | ||||
| 						if co.ClientID == 0 { | ||||
| 							bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("Company '%s' unclaimed. Please /register to claim the company", s.Status.Companies[sp.CompanyID].Name)) | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 			} else if clt.CompanyID != 255 && cfg.CompanyIsRegistered(clt.CompanyID) { | ||||
| 				cc := cfg.GetCompanyClient(clt.CompanyID) | ||||
| @ -298,22 +303,12 @@ func (s *ServerTTD) Poll(stop chan struct{}) { | ||||
| 			} | ||||
| 			sp.Read(buffer[:p.PLength]) | ||||
| 			logInfoDebug("Server.Poll() : AdminPacketServerClientQuit :\n-  ClientID: %d", sp.ClientID) | ||||
| 			if len(s.Status.Clients) == 2 && !srv.Status.Paused { | ||||
| 				if cfg.CompanyIsRegistered(s.Status.Clients[sp.ClientID].CompanyID) { | ||||
| 					cc := cfg.GetCompanyClient(s.Status.Clients[sp.ClientID].CompanyID) | ||||
| 					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s leaving. Game paused.", cc.Username)) | ||||
| 					cc.Online = false | ||||
| 				} else { | ||||
| 					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("%s leaving. Game paused.", s.Status.Clients[sp.ClientID].Name)) | ||||
| 				} | ||||
| 			if cfg.CompanyIsRegistered(s.Status.Clients[sp.ClientID].CompanyID) { | ||||
| 				cc := cfg.GetCompanyClient(s.Status.Clients[sp.ClientID].CompanyID) | ||||
| 				bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s leaving.", cc.Username)) | ||||
| 				cc.Online = false | ||||
| 			} else { | ||||
| 				if cfg.CompanyIsRegistered(s.Status.Clients[sp.ClientID].CompanyID) { | ||||
| 					cc := cfg.GetCompanyClient(s.Status.Clients[sp.ClientID].CompanyID) | ||||
| 					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s leaving.", cc.Username)) | ||||
| 					cc.Online = false | ||||
| 				} else { | ||||
| 					bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("%s leaving.", s.Status.Clients[sp.ClientID].Name)) | ||||
| 				} | ||||
| 				bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("%s leaving.", s.Status.Clients[sp.ClientID].Name)) | ||||
| 			} | ||||
| 			delete(s.Status.Clients, sp.ClientID) | ||||
| 		case AdminPacketServerCompanyNew: | ||||
| @ -325,6 +320,7 @@ func (s *ServerTTD) Poll(stop chan struct{}) { | ||||
| 			c := &CompanyTTD{ | ||||
| 				CompanyID: sp.CompanyID, | ||||
| 				FirstSeen: time.Now(), | ||||
| 				ClientID:  0, | ||||
| 			} | ||||
| 			s.Status.Companies[sp.CompanyID] = c | ||||
| 		case AdminPacketServerCompanyInfo: | ||||
| @ -336,6 +332,7 @@ func (s *ServerTTD) Poll(stop chan struct{}) { | ||||
| 			c := &CompanyTTD{ | ||||
| 				CompanyID: sp.CompanyID, | ||||
| 				FirstSeen: time.Now(), | ||||
| 				ClientID:  0, | ||||
| 			} | ||||
| 			if _, ok := s.Status.Companies[sp.CompanyID]; !ok { | ||||
| 				s.Status.Companies[sp.CompanyID] = c | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| // Code generated by version.sh (@generated) DO NOT EDIT. | ||||
| package main | ||||
| var githash = "f85da9b" | ||||
| var buildstamp = "2021-11-06_16:26:28" | ||||
| var commits = "162" | ||||
| var version = "f85da9b-b162 - 2021-11-06_16:26:28" | ||||
| var githash = "63b7d31" | ||||
| var buildstamp = "2021-11-06_16:52:50" | ||||
| var commits = "164" | ||||
| var version = "63b7d31-b164 - 2021-11-06_16:52:50" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user